java.lang.ClassCastException: org.dom4j.tree.DefaultElement

Hibernate JIRA | Michał Kłujszo | 1 decade ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    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)

    Hibernate JIRA | 1 decade ago | Michał Kłujszo
    java.lang.ClassCastException: org.dom4j.tree.DefaultElement
  2. 0

    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)

    Hibernate JIRA | 1 decade ago | Michał Kłujszo
    java.lang.ClassCastException: org.dom4j.tree.DefaultElement

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.dom4j.tree.DefaultElement

      at org.hibernate.type.DynamicComponentType.setPropertyValues()
    2. Hibernate
      BasicEntityPersister.instantiate
      1. org.hibernate.type.DynamicComponentType.setPropertyValues(DynamicComponentType.java:102)
      2. org.hibernate.tuple.AbstractTuplizer.setIdentifier(AbstractTuplizer.java:126)
      3. org.hibernate.tuple.AbstractTuplizer.instantiate(AbstractTuplizer.java:223)
      4. org.hibernate.persister.entity.BasicEntityPersister.instantiate(BasicEntityPersister.java:2919)
      4 frames
    3. Hibernate
      SessionImpl.instantiate
      1. org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:977)
      2. org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:969)
      2 frames
    4. Hibernate
      QueryLoader.list
      1. org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:824)
      2. org.hibernate.loader.Loader.getRow(Loader.java:746)
      3. org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:290)
      4. org.hibernate.loader.Loader.doQuery(Loader.java:384)
      5. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
      6. org.hibernate.loader.Loader.doList(Loader.java:1499)
      7. org.hibernate.loader.Loader.list(Loader.java:1482)
      8. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365)
      8 frames
    5. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.list
      1. org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268)
      1 frame
    6. Hibernate
      QueryImpl.list
      1. org.hibernate.impl.SessionImpl.list(SessionImpl.java:782)
      2. org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
      2 frames
    7. pzl.copier
      Tester.main
      1. pzl.copier.Tester.main(Tester.java:38)
      1 frame