spkhillar / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

HibernateMetadataUtil not working with proxy objects. #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am getting the following error while trying to save an object (using 
version 0.4.3):

java.lang.IllegalArgumentException: Unable to introspect class
model.user.UserRole$$EnhancerByCGLIB$$85928456. The class is not a
registered Hibernate entity
com/trg/search/hibernate/HibernateMetadataUtil.java:78:in `get'
com/trg/search/hibernate/HibernateMetadataUtil.java:48:in `getId'
com/trg/dao/hibernate/BaseDAOImpl.java:144:in `_saveOrUpdateIsNew'
com/trg/dao/dao/standard/GenericDAOImpl.java:86:in `save'
entity.user.UserRoleManager:-1:in `save'
sun/reflect/DelegatingMethodAccessorImpl.java:25:in `invoke'
java/lang/reflect/Method.java:597:in `invoke'

The problem comes because Hibernate's getClassMetadata(Class<?>) method, 
does not recognize the class model.user.UserRole$$EnhancerByCGLIB$$85928456 
as a registered entity even though it is a proxy for model.user.UserRole, 
which is a registered entity.

We will need to fix our HibernateMetadataUtil class to deal with this 
situation.

Thanks Jas for reporting this.

Original issue reported on code.google.com by dwolvert on 26 May 2009 at 2:20

GoogleCodeExporter commented 9 years ago
Fixed for 0.5.0.

Original comment by dwolvert on 26 May 2009 at 3:43