[Hibernate-JIRA] Updated: (HHH-422) xml entity bindings for subclass entities
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-422?page=all ]
Steve Ebersole updated HHH-422:
-------------------------------
Fix Version: entity-modes
(was: 3.2.2)
> xml entity bindings for subclass entities
> -----------------------------------------
>
> Key: HHH-422
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-422
> Project: Hibernate3
> Type: Improvement
> Components: core
> Versions: 3.0.2
> Environment: Hibernate cvs head from main branch .(As of 4/28/05..So 3.0.2?), Oracle 8i.
> Reporter: Jesse Kuhnert
> Assignee: Steve Ebersole
> Fix For: entity-modes
> Attachments: XMLSubclassTest.zip
>
> Original Estimate: 1 week
> Remaining: 1 week
>
> I'm sure someone else is already in the process of agnonizing over how to handle the entity name resolution issues that are currently floating around in the codebase, but for the sake of not knowing who's doing what and what-not (heh), I thought I would share my couple quick notes learned from trying to make this work today.
> I was having problems getting an import of xml data into hibernate with derived subclasses of one base class. (Not abstract, derived using the discriminator value column and table per subclass method). Was getting lots of errors trying to map my subclass nodes into the main xml document, even if I named the child nodes the same as the parent. The only eventual temporary solution I could find was by adding the subclass "node name" values into the two Map instances I could find that needed these references. [Mappings class and EntityPersister, ughh I've forgotten the other ones name now. ]
> The one main culprit already had an obvious method comment with a TODO tag so I'm sure someone is already working on a much better longterm solution than mine.. The only thing I didn't complete was having the ability for the subclass instances to have their own node names. Ie if I had an instance of the base class mapped as a many-to-XX collection in someone's class, I had to specify a node name of "something" to get it to be recognized. I didn't get far enough in my day to get this part as well, but I think it would just require being able to reference the current child somehow. Some sort of XSLT expression like "name()" or "self" perhaps?
> After that everything worked beautifully of course :) Will be very excited to see this feature come to full bloom, as I plan on using it to synchronize some data points with customer databases sometime this summer? (Am I being too hopeful? I'd love to help, but I'm sure there are plenty of good people doing things already..And I'm I'm fu#$!@ with my own deadlines anyways...)
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 1 month
[Hibernate-JIRA] Updated: (HHH-1039) WrongClassException when scrolling through EntityMode.DOM4J and loading identical objects from different fields
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1039?page=all ]
Steve Ebersole updated HHH-1039:
--------------------------------
Fix Version: entity-modes
(was: 3.2.2)
> WrongClassException when scrolling through EntityMode.DOM4J and loading identical objects from different fields
> ---------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1039
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1039
> Project: Hibernate3
> Type: Bug
> Versions: 3.0.5
> Environment: Windows XP, JDK 1.4.2_8, Hibernate 3.0.5, Oracle 9.2. Replicated on Windows XP, JDK 1.5.0_2, Hibernate 3.0.5, MySQL
> Reporter: Roland Groen
> Fix For: entity-modes
> Attachments: HbmXmlTest.java, Test.hbm.xml
>
>
> When working with XML representations of entities, an unexpected org.hibernate.WrongClassException is thrown when working with identical embedded objects (embed-xml="true") which have different field names.
> org.hibernate.WrongClassException seems to be thrown when:
> 1) Running in EntityMode.DOM4J
> 2) Scrolling through a result set using session.scroll()
> 3) Embedding objects that are:
> a) Referred by least by one of the objects on which the query is selecting primarily (parent object) and,
> b) that field is in FetchMode.JOIN.
> c) Referred by one object which is embedded (embed-xml="true") and uses a different field name to refer to the object than the parent object.
> I would like to apologise for the large test case. The bug is quite hard to reproduce, I tried to minimise the test, but this seems the smallest and most simple case I can find.
> The stack trace is:
> Caused by: org.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass: Customer (loaded object was of wrong class)
> at org.hibernate.loader.Loader.instanceAlreadyLoaded(Loader.java:890)
> at org.hibernate.loader.Loader.getRow(Loader.java:846)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:305)
> at org.hibernate.loader.Loader.loadSingleRow(Loader.java:238)
> at org.hibernate.impl.ScrollableResultsImpl.prepareCurrentRow(ScrollableResultsImpl.java:477)
> at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:106)
> at HbxXmlTest.main(HbxXmlTest.java:90)
> The included files are:
> Test.hbm.xml : the hbm file to create the classes
> HbmXmlTest.java : the the java source to reproduce the issue.
> Greetings,
> Roland.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 1 month
[Hibernate-JIRA] Updated: (HHH-1217) Problems loading lists of scalar values via EntityMode.DOM4J
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1217?page=all ]
Steve Ebersole updated HHH-1217:
--------------------------------
Fix Version: entity-modes
(was: 3.2.2)
> 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: entity-modes
>
>
> 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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 1 month
[Hibernate-JIRA] Updated: (HHH-616) replicate() with a bidirectional relationship fails (dom4j)
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-616?page=all ]
Steve Ebersole updated HHH-616:
-------------------------------
Fix Version: entity-modes
(was: 3.2.2)
> replicate() with a bidirectional relationship fails (dom4j)
> -----------------------------------------------------------
>
> Key: HHH-616
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-616
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.0.5
> Environment: Hibernate 3.0.5; MySQL 4.1.12
> Reporter: David Tashima
> Assignee: Gavin King
> Fix For: entity-modes
> Attachments: test.zip, test3.zip
>
>
> Here is the original forum post:
> http://forum.hibernate.org/viewtopic.php?t=943520
> Basically, I am trying to transfer stuff from one DB to another via the Dom4j session. I create an XML document from the source DB and then I am using session.replicate() on the receiving end to instantiate the new objects from that XML document.
> It works for simple objects, but when I have a bidirectional reference, it is unable to .replicate() the pair of objects, even if I try to commit() them all in the same transaction.
> I have created a simple model to reproduce this.
> Mapping document:
> <hibernate-mapping
> package="data">
> <class name="Foo"
> table="foo"
> >
> <id name="id"
> node="@id"
> type="string"
> unsaved-value="null"
> column="foo_id" >
> <generator class="uuid" />
> </id>
> <property
> name="prop1"
> column="prop1"
> type="string"
> />
> <many-to-one
> name="bar"
> column="bar_id"
> class="Bar"
> not-null="false"
> embed-xml="false"
> />
> <property
> name="index"
> column="foo_index"
> type="int"
> update="true"
> />
> </class>
> <class name="Bar"
> table="bar"
> >
> <id name="id"
> node="@id"
> type="string"
> unsaved-value="null"
> column="bar_id" >
> <generator class="uuid" />
> </id>
> <list
> name="foos"
> node="foos"
> embed-xml="true"
> inverse="true"
> lazy="false">
> <key column="bar_id"/>
> <list-index column="foo_index"/>
> <one-to-many
> class="Foo"
> embed-xml="false"
> node="foo"
> />
> </list>
> </class>
> </hibernate-mapping>
> Reconstitution code:
> try
> {
> SAXReader reader = new SAXReader();
> Document doc = reader.read(new File("content.xml"));
> Session session = currentSession();
> Session s = session.getSession(EntityMode.DOM4J);
> Transaction txn = s.beginTransaction();
> {
> List elems = doc.getRootElement().elements();
> Iterator it = elems.iterator();
> while(it.hasNext())
> {
> Element e = (Element)it.next();
> log.debug(e.getName());
> if(e.getName().equals("Foo"))
> s.replicate("data.Foo",e, ReplicationMode.IGNORE);
> if(e.getName().equals("Bar"))
> s.replicate("data.Bar",e, ReplicationMode.IGNORE);
> }
> }
> txn.commit();
> }
> catch(DocumentException e)
> {
> log.error(e);
> }
> Here is the stack trace:
> 150 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot add or update a child row: a foreign key constraint fails
> 291 [main] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
> org.hibernate.exception.ConstraintViolationException: could not insert: [data.Foo]
> at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:74)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1869)
> at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
> at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
> at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
> at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:329)
> at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
> at Test.reconstitute(Test.java:69)
> at Test.main(Test.java:40)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
> Caused by: java.sql.SQLException: Cannot add or update a child row: a foreign key constraint fails
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
> at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1366)
> at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:952)
> at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1974)
> at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1897)
> at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1758)
> at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
> at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1853)
> ... 17 more
> Exception in thread "main" org.hibernate.exception.ConstraintViolationException: could not insert: [data.Foo]
> at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:74)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1869)
> at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
> at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
> at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
> at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:329)
> at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
> at Test.reconstitute(Test.java:69)
> at Test.main(Test.java:40)
> And finally, here is the XML document I am attempting to reconstitute:
> <root>
> <Foo id="402881e4045ce90c01045ce90f950002">
> <prop1>abcd</prop1>
> <bar>402881e4045ce90c01045ce90f770001</bar>
> <index>0</index>
> </Foo>
> <Foo id="402881e4045ce90c01045ce90f9f0003">
> <prop1>456</prop1>
> <bar>402881e4045ce90c01045ce90f770001</bar>
> <index>1</index>
> </Foo>
> <Bar id="402881e4045ce90c01045ce90f770001">
> <foos>
> <foo>402881e4045ce90c01045ce90f950002</foo>
> <foo>402881e4045ce90c01045ce90f9f0003</foo>
> </foos>
> </Bar>
> </root>
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 1 month
[Hibernate-JIRA] Updated: (HHH-796) Hibernate fails to determine identifier of association inside composite-element in EntityMode.DOM4J when declared with embed-xml="false"
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-796?page=all ]
Steve Ebersole updated HHH-796:
-------------------------------
Fix Version: entity-modes
(was: 3.2.2)
> Hibernate fails to determine identifier of association inside composite-element in EntityMode.DOM4J when declared with embed-xml="false"
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-796
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-796
> Project: Hibernate3
> Type: Bug
> Versions: 3.0.5
> Environment: Hibernate 3.0.5; Windows; MySQL 4.1
> Reporter: Vladimir Demochko
> Fix For: entity-modes
> Attachments: TestBug.zip
>
>
> Having the following mapping declaration:
> <class name="Parent">
> <id name="id"/>
> <property name="label"/>
> <bag name="associations" table="ASSOCIATION" cascade="all">
> <key column="PARENT_ID"/>
> <composite-element class="Association" node="associations">
> <parent name="parent"/>
> <many-to-one name="child" class="Child" column="CHILD_ID" node="child" embed-xml="false"/>
> <property name="info" column="INFO" type="string"/>
> </composite-element>
> </bag>
> </class>
> <class name="Child">
> <id name="id"/>
> <property name="info"/>
> </class>
> Hibernate fails with NullPointerException while constructing Parent/assosiations/child element (in fact while getting an identifier of a Child object) in EntityMode.DOM4J:
> java.lang.NullPointerException
> at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:227)
> at org.hibernate.type.EntityType.setToXMLNode(EntityType.java:417)
> at org.hibernate.property.Dom4jAccessor$ElementSetter.set(Dom4jAccessor.java:307)
> at org.hibernate.tuple.AbstractComponentTuplizer.setPropertyValues(AbstractComponentTuplizer.java:80)
> at org.hibernate.type.ComponentType.setPropertyValues(ComponentType.java:262)
> at org.hibernate.type.ComponentType.resolve(ComponentType.java:446)
> at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:182)
> at org.hibernate.persister.collection.AbstractCollectionPersister.readElement(AbstractCollectionPersister.java:612)
> at org.hibernate.collection.PersistentElementHolder.readFrom(PersistentElementHolder.java:97)
> at org.hibernate.loader.Loader.readCollectionElement(Loader.java:645)
> at org.hibernate.loader.Loader.readCollectionElements(Loader.java:355)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:306)
> at org.hibernate.loader.Loader.doQuery(Loader.java:395)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
> at org.hibernate.loader.Loader.loadCollection(Loader.java:1401)
> at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:107)
> at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:483)
> at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
> at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1422)
> at org.hibernate.type.CollectionType.getCollection(CollectionType.java:474)
> 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:510)
> at org.hibernate.loader.Loader.doQuery(Loader.java:419)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
> at org.hibernate.loader.Loader.loadEntity(Loader.java:1312)
> at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:116)
> at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:101)
> at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2461)
> at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:350)
> at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:331)
> at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:113)
> at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:151)
> at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79)
> at org.hibernate.impl.SessionImpl.get(SessionImpl.java:617)
> at org.hibernate.impl.SessionImpl.get(SessionImpl.java:610)
> at TestBug.main(TestBug.java:21)
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 1 month
[Hibernate-JIRA] Updated: (HHH-874) org.hibernate.AssertionFailure: null owner only with EntityMode.DOM4J
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-874?page=all ]
Steve Ebersole updated HHH-874:
-------------------------------
Fix Version: entity-modes
(was: 3.2.2)
> org.hibernate.AssertionFailure: null owner only with EntityMode.DOM4J
> ---------------------------------------------------------------------
>
> Key: HHH-874
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-874
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1 beta 2
> Environment: Hibernate up to 3.1 beta 2, SQL Server
> Reporter: Martin Caslavsky
> Fix For: entity-modes
>
>
> ERROR - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
> org.hibernate.AssertionFailure: null owner
> at org.hibernate.collection.PersistentElementHolder.<init>(PersistentElementHolder.java:61)
> at org.hibernate.type.SetType.instantiate(SetType.java:23)
> at org.hibernate.engine.CollectionLoadContext.getLoadingCollection(CollectionLoadContext.java:101)
> 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:579)
> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
> at org.hibernate.loader.Loader.loadCollection(Loader.java:1916)
> at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
> at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
> at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
> at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1555)
> at org.hibernate.type.CollectionType.getCollection(CollectionType.java:501)
> at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:335)
> at org.hibernate.type.CollectionType.resolve(CollectionType.java:329)
> at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
> at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
> at org.hibernate.loader.Loader.loadEntity(Loader.java:1782)
> at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
> at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
> at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2705)
> at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
> at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
> at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
> at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
> at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
> at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:774)
> at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:746)
> at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
> at org.hibernate.type.EntityType.resolve(EntityType.java:303)
> at org.hibernate.type.EntityType.nullSafeGet(EntityType.java:217)
> at org.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:93)
> at org.hibernate.impl.IteratorImpl.next(IteratorImpl.java:120)
> at ProduktCon.result(ProduktCon.java:42)
> at AbstractCon.go(AbstractCon.java:114)
> at Datacon.main(Datacon.java:31)
> ProduktCon.java:
> protected void result() {
> Session session4 = factory.openSession().getSession(EntityMode.DOM4J);
> Query query = session4.createQuery("select p from Produkt as p");
> for (Iterator it = query.iterate(); it.hasNext();) {
> Element e = (Element) it.next(); // LINE 42
> }
> }
> Produkt.hbm.xml:
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
> <hibernate-mapping>
> <class name="Produkt" table="eshop_prod" node="product">
> <id name="produkt" type="string" unsaved-value="any" column="produkt" node="@id"/>
> <property name="cislo" column="Katalogove_cislo" node="@cislo"/>
> <property name="popis" column="popis" node="name"/>
> <property name="poznamka" column="poznamka" node="anotace"/>
> <property name="text" column="text" node="descr"/>
> <property name="zaruka" column="zaruka" node="@zaruka"/>
> <property name="vyrobce" column="vyrobce" node="vyrobce"/>
> <property name="dodavatel" column="dodavatel" node="dodavatel"/>
> <property name="zarazeni" column="zarazeni" node="@zarazeni" />
> <property name="dostupnost" column="Carovy_kod_vlastni" node="@dostupnost" />
> <set name="kategorie" embed-xml="true" node=".">
> <key column="produkt"/>
> <one-to-many class="Kategorie"/>
> </set>
> <set name="related" embed-xml="true" node="." where="typ_souvislosti=0">
> <key column="produkt"/>
> <one-to-many class="Related"/>
> </set>
> <set name="item" embed-xml="true" node=".">
> <key column="vyrobek"/>
> <one-to-many class="Item"/>
> </set>
> <set name="variant" embed-xml="true" node=".">
> <key column="prod_id"/>
> <one-to-many class="Variant"/>
> </set>
> </class>
> </hibernate-mapping>
> Last executed SQL statement:
> Hibernate: select variant0_.prod_id as prod5_1_, variant0_.produkt as produkt1_, variant0_.produkt as produkt4_0_, variant0_.Katalogove_cislo as Katalogove2_4_0_, variant0_.Udaj_1 as Udaj3_4_0_, variant0_.Udaj_2 as Udaj4_4_0_ from data0001.dbo.eshop_variant variant0_ where variant0_.prod_id=?
> This error occurs only with EntityMode.DOM4J.
> Also when removed <set name="variant" ... > everything works OK.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 1 month