Hi Guys,
I getting the following exception:
org.hibernate.PropertyAccessException: exception getting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) getter of com.hibernate.poc.MeetingKey.?
when i try to run this code
Property keyProperty = Property.forName("key");
Meeting gp = (Meeting)ses.createCriteria(Meeting.class)
.setFetchMode("chronologyTextValues",FetchMode.JOIN)
.add(keyProperty.getProperty("caseId").eq("WAK"))
.add(keyProperty.getProperty("eventSeq").eq(new Integer(1)))
.add(keyProperty.getProperty("groupSeq").eq(new Integer(1)))
.add(keyProperty.getProperty("participantId").eq(new Integer(220)))
.add(keyProperty.getProperty("meetingSeq").eq(new Integer(2)))
.uniqueResult();
can any one please help me out.
Hibernate version: Hibernate 3.1.2
Mapping documents: <class name="Meeting" table="meeting"> <composite-id name="key" class="MeetingKey"> <key-property name="caseId" column="case_id"/> <key-property name="eventSeq" column="event_seq"/> <key-property name="groupSeq" column="group_seq"/> <key-property name="participantId" column="participant_id"/> <key-property name="meetingSeq" column="meeting_seq"/> </composite-id>
<property name="name" column="meeting_title"/> <property name="meetingDate" column="meeting_date"/> <property name="time" column="time_of_day"/>
<set name="chronologyTextValues" inverse="true"> <key column="text_id" property-ref="descriptionId"/> <one-to-many class="ChronologyText"/> </set>
<property name="descriptionId" column="description_text_id" unique="true"/> </class>
<class name="ChronologyText" table="chronology_text"> <composite-id name="key" class="ChronologyTextKey"> <key-property name="textId" column="text_id"/> <key-property name="sequenceNum" column="sequence_num"/> </composite-id> <!-- <id name="textId" column="text_id"> <generator class="assigned"></generator> </id> <property name="sequenceNum" column="sequence_num"></property> --> <many-to-one name="meeting" column="text_id" property-ref="descriptionId" insert="false" update="false"></many-to-one> <property name="textValue" column="text_value" /> </class>
Code between sessionFactory.openSession() and session.close(): Property keyProperty = Property.forName("key"); Meeting gp = (Meeting)ses.createCriteria(Meeting.class) .setFetchMode("chronologyTextValues",FetchMode.JOIN) .add(keyProperty.getProperty("caseId").eq("WAK")) .add(keyProperty.getProperty("eventSeq").eq(new Integer(1))) .add(keyProperty.getProperty("groupSeq").eq(new Integer(1))) .add(keyProperty.getProperty("participantId").eq(new Integer(220))) .add(keyProperty.getProperty("meetingSeq").eq(new Integer(2))) .uniqueResult();
Full stack trace of any exception that occurs: org.hibernate.PropertyAccessException: exception getting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) getter of com.hibernate.poc.MeetingKey.? at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:79) at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:307) at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:158) at org.hibernate.engine.EntityKey.getHashCode(EntityKey.java:69) at org.hibernate.engine.EntityKey.<init>(EntityKey.java:42) at org.hibernate.engine.StatefulPersistenceContext.getCollectionOwner(StatefulPersistenceContext.java:717) at org.hibernate.engine.CollectionLoadContext.getLoadingCollection(CollectionLoadContext.java:88) at org.hibernate.loader.Loader.readCollectionElement(Loader.java:990) at org.hibernate.loader.Loader.readCollectionElements(Loader.java:635) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580) at org.hibernate.loader.Loader.doQuery(Loader.java:689) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1552) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:284) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:306) at com.hibernate.poc.Main.main(Main.java:248) Caused by: java.lang.ClassCastException: java.lang.Integer at com.hibernate.poc.MeetingKey$$BulkBeanByCGLIB$$ea426f57.getPropertyValues(<generated>) at net.sf.cglib.beans.BulkBean.getPropertyValues(BulkBean.java:48) at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:76)
with thanks
krishna
|