java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • XMLMapping doesn't seems to work correctly with composite-id Mapping: <class entity-name="PUsersRolesRegions" node="urr" table="p_users_roles_regions"> <composite-id node="urr/id"> <key-property name="p_user_id" type="integer"/> <key-property name="p_role_id" type="integer"/> <key-property name="p_region_id" type="integer"/> </composite-id> </class> Code: Session session = sessions.openSession(); Session dom4jSession = session.openSession( EntityMode.DOM4J ); results = dom4jSession.createQuery("from PUser").list(); StackTrace: Exception in thread "main" java.lang.ClassCastException: org.dom4j.tree.DefaultElement at org.hibernate.type.DynamicComponentType.setPropertyValues(DynamicComponentType.java:102) at org.hibernate.tuple.AbstractTuplizer.setIdentifier(AbstractTuplizer.java:126) at org.hibernate.tuple.AbstractTuplizer.instantiate(AbstractTuplizer.java:223) at org.hibernate.persister.entity.BasicEntityPersister.instantiate(BasicEntityPersister.java:2919) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:977) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:969) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:824) at org.hibernate.loader.Loader.getRow(Loader.java:746) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:290) at org.hibernate.loader.Loader.doQuery(Loader.java:384) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203) at org.hibernate.loader.Loader.doList(Loader.java:1499) at org.hibernate.loader.Loader.list(Loader.java:1482) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at pzl.copier.Tester.main(Tester.java:38)
    via by Michał Kłujszo,
  • XMLMapping doesn't seems to work correctly with composite-id Mapping: <class entity-name="PUsersRolesRegions" node="urr" table="p_users_roles_regions"> <composite-id node="urr/id"> <key-property name="p_user_id" type="integer"/> <key-property name="p_role_id" type="integer"/> <key-property name="p_region_id" type="integer"/> </composite-id> </class> Code: Session session = sessions.openSession(); Session dom4jSession = session.openSession( EntityMode.DOM4J ); results = dom4jSession.createQuery("from PUser").list(); StackTrace: Exception in thread "main" java.lang.ClassCastException: org.dom4j.tree.DefaultElement at org.hibernate.type.DynamicComponentType.setPropertyValues(DynamicComponentType.java:102) at org.hibernate.tuple.AbstractTuplizer.setIdentifier(AbstractTuplizer.java:126) at org.hibernate.tuple.AbstractTuplizer.instantiate(AbstractTuplizer.java:223) at org.hibernate.persister.entity.BasicEntityPersister.instantiate(BasicEntityPersister.java:2919) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:977) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:969) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:824) at org.hibernate.loader.Loader.getRow(Loader.java:746) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:290) at org.hibernate.loader.Loader.doQuery(Loader.java:384) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203) at org.hibernate.loader.Loader.doList(Loader.java:1499) at org.hibernate.loader.Loader.list(Loader.java:1482) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at pzl.copier.Tester.main(Tester.java:38)
    via by Michał Kłujszo,
    • java.lang.ClassCastException: org.dom4j.tree.DefaultElement at org.hibernate.type.DynamicComponentType.setPropertyValues(DynamicComponentType.java:102) at org.hibernate.tuple.AbstractTuplizer.setIdentifier(AbstractTuplizer.java:126) at org.hibernate.tuple.AbstractTuplizer.instantiate(AbstractTuplizer.java:223) at org.hibernate.persister.entity.BasicEntityPersister.instantiate(BasicEntityPersister.java:2919) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:977) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:969) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:824) at org.hibernate.loader.Loader.getRow(Loader.java:746) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:290) at org.hibernate.loader.Loader.doQuery(Loader.java:384) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203) at org.hibernate.loader.Loader.doList(Loader.java:1499) at org.hibernate.loader.Loader.list(Loader.java:1482) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at pzl.copier.Tester.main(Tester.java:38)
    No Bugmate found.