[jboss-user] [JBoss Seam] - Re: Seam 2.0 weird exception in org.jboss.seam.Entity

mgrouch do-not-reply at jboss.com
Wed Jul 25 12:21:43 EDT 2007


This is really weird to me as I would have expected class to be

com.test.portal.data.entity.Team

however

getClass() prints its proxy

com.test.portal.data.entity.Team_$$_javassist_9

My entity is detached at that point (it is returned from session EJB under CMT) and it is fully initialized (no lazy load exception occurs when I print its values)

I've tried setting hibernate.bytecode.use_reflection_optimizer=false
to no avail.

Just to explain what happens in my code

	public Object getId(Object bean) {
  | 		return Entity.forClass(bean.getClass()).getIdentifier(bean);
  | 	}

getId is called for this entity (Team)

and getIdentifier throws exception

   public Object getIdentifier(Object entity)
  |    {
  |       if (identifierGetter!=null)
  |       {
  |          return Reflections.invokeAndWrap(identifierGetter, entity);
  |       }
  |       else if (identifierField!=null)
  |       {
  |          return Reflections.getAndWrap(identifierField, entity);
  |       }
  |       else
  |       {
  |          throw new IllegalStateException("@Id attribute not found for entity class: " + getBeanClass().getName());
  |       }
  |    }

My suspicion that is caused by class of object being
com.test.portal.data.entity.Team_$$_javassist_9
instead of real one
com.test.portal.data.entity.Team.

Any ideas?
Thanks


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067491#4067491

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067491



More information about the jboss-user mailing list