Here is the class hierarchy I have:
Person
-superClassOf-> StaffMember
-superClassOf-> VIP
What's happening is the same person is a StaffMember and VIP. So when I try
and load them both into memory, Hibernate seems to try and cast a StaffMember
to a VIP (an vice versa) depending on which is loaded first.
I know that this may not be the best design. Any way I can work around this?
Code:
Exception in thread "main" org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.jfys.datafest.domain.EventVip.setVip
at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:215)
at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:185)
at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3232)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:126)
...
Caused by: net.sf.cglib.beans.BulkBeanException: com.jfys.datafest.domain.ArtisticCompany
at com.jfys.datafest.domain.EventVip$$BulkBeanByCGLIB$$d52d879a.setPropertyValues(<generated>)
at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:212)
... 15 more
Caused by: java.lang.ClassCastException: com.jfys.datafest.domain.ArtisticCompany
... 17 more