This content has been marked as final.
Show 2 replies
-
1. Re: EntityManager.getReference returned object class
bill.burke Sep 2, 2005 5:10 PM (in response to ebu)AFAIK, Hibernate (the underlying persistence mechanisms) extends your persistence class so that it can "intercept" get/set methods to perform more efficient dirty checking and lazy loading.
So your best bet is:
a.getClass().getSuperclass().getDeclaredField("name"); -
2. Re: EntityManager.getReference returned object class
epbernard Sep 8, 2005 12:05 PM (in response to ebu)This might even fail if by chance the object was already in the session, since the actual A class will be returned.
Note this is compliant with the spec since mypack.A$$EnhancerByCGLIB$$4f0ecd01 is actually a subclass of A, thus a is an instance of A.
To do what you want, you can do Hibernate.getClass(a).getDeclaredField()