[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1217) Problems loading lists of scalar values via EntityMode.DOM4J
Alexander Kiel (JIRA)
noreply at atlassian.com
Fri Sep 15 10:15:24 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1217?page=comments#action_24506 ]
Alexander Kiel commented on HHH-1217:
-------------------------------------
I had this issue to. It's right what Craig says. You have to specify a node name.
> Problems loading lists of scalar values via EntityMode.DOM4J
> ------------------------------------------------------------
>
> Key: HHH-1217
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1217
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.0.5
> Environment: HIbernate 3.0.5, MySql 4.10 (Innodb), Windows XP
> Reporter: Patrick Casey
> Fix For: 3.2.2
>
>
> Mappings which contain lists of scalar values (as opposed to lists of mapped objects) throw NPEs when you try to load them via a DOM4J session.
> **The Mapping:
> <class name="metadata.MetaFormDescriptor" table="metaform">
> <cache usage="read-write" />
> <id name="id" type="string" length="32">
> <column name="id" length="32" not-null="true"/>
> <generator class="uuid.hex"/>
> </id>
> <property name="objectClass" column="objectclass" type="string"/>
> <many-to-one name="user" class="core.User" embed-xml="false">
> <column name="user_id" length="32"></column>
> </many-to-one>
> <list name="listA" table="mfa" fetch="join" cascade="all-delete-orphan" embed-xml="false">
> <key column="form_id" />
> <index column="sequence" />
> <element type="string" column="encoded"/>
> </list>
> <list name="listB" table="mfb" fetch="join" cascade="all-delete-orphan" embed-xml="false">
> <key column="form_id" />
> <index column="sequence" />
> <element type="string" column="encoded"/>
> </list>
> <list name="listC" table="mfc" fetch="join" cascade="all-delete-orphan" embed-xml="false">
> <key column="form_id" />
> <index column="sequence" />
> <element type="string" column="encoded"/>
> </list>
> </class>
> **The Code that Loads it:
> Session sxml = snormal.getSession(EntityMode.DOM4J);
> sxml.setFlushMode(FlushMode.NEVER);
> List l = sxml.createQuery("from " + MetaFormDescriptor.class.getCanonicalName()).list();
> ** The Dump you get:
> Exception in thread "main" java.lang.NullPointerException
> at org.dom4j.tree.AbstractElement.addElement(AbstractElement.java:1169)
> at org.hibernate.collection.PersistentIndexedElementHolder.readFrom(PersistentIndexedElementHolder.java:135)
> at org.hibernate.loader.Loader.readCollectionElement(Loader.java:674)
> at org.hibernate.loader.Loader.readCollectionElements(Loader.java:370)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:314)
> at org.hibernate.loader.Loader.doQuery(Loader.java:412)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
> at org.hibernate.loader.Loader.loadCollection(Loader.java:1434)
> at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:99)
> at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:488)
> at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
> at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1430)
> at org.hibernate.type.CollectionType.getCollection(CollectionType.java:484)
> at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:332)
> at org.hibernate.type.CollectionType.resolve(CollectionType.java:326)
> at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:105)
> at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)
> at org.hibernate.loader.Loader.doQuery(Loader.java:436)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
> at org.hibernate.loader.Loader.doList(Loader.java:1593)
> at org.hibernate.loader.Loader.list(Loader.java:1577)
> at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
> at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
> at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
> at bootstrap.PrimeMover.unLoadOneFile(PrimeMover.java:41)
> at bootstrap.PrimeMover.unLoadSeed(PrimeMover.java:59)
> at zzTest.Tester.main(Tester.java:736)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list