[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-3046) Merge fails on complicated data structure because of cycle references

Gail Badner (JIRA) noreply at atlassian.com
Tue Jun 2 23:02:14 EDT 2009


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner resolved HHH-3046.
------------------------------

       Resolution: Fixed
    Fix Version/s: 3.5
                   3.3.x
                   3.2.x

Fixed by HHH-3810.

> Merge fails on complicated data structure because of cycle references
> ---------------------------------------------------------------------
>
>                 Key: HHH-3046
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3046
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.2.4
>         Environment: Hibernate-3.2.4.ga, db-platform any (h2 &  oracle tested)
>            Reporter: Pavol Zibrita
>            Assignee: Gail Badner
>             Fix For: 3.2.x, 3.3.x, 3.5
>
>         Attachments: HHH3046.hbm.xml, HHH3046Fix_Branch_3_2.patch, HHH3046Fix_entityManager_Branch_3_2.patch, HHH3046Test_entityManager_Branch_3_2.patch, HHH3046TestCase_Branch_3_2.patch, HibernateBug_HHH3046.zip
>
>
> On complicated object structure, hibernate was unable to merge it correctly because of attaching ID's to the new objects in the tree of the persistent entity. Hibernate cannot cope with cyclic references in this case and it fails with:
> javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.bugtests.data.Transport.pickupNode
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:237)
> 	at org.hibernate.bugtests.merge.MergeBug.mergeData(MergeBug.java:131)
> 	at org.hibernate.bugtests.merge.MergeBug.testBug(MergeBug.java:149)
> 	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:597)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.bugtests.data.Transport.pickupNode
> 	at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
> 	at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
> 	at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
> 	at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
> 	at org.hibernate.ejb.event.EJB3MergeEventListener.saveWithGeneratedId(EJB3MergeEventListener.java:43)
> 	at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:186)
> 	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
> 	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
> 	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
> 	at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
> 	at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
> 	at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> 	at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
> 	at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:194)
> 	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
> 	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
> 	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
> 	at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
> 	at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
> 	at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> 	at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
> 	at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:194)
> 	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
> 	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
> 	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
> 	at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
> 	at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> 	at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:431)
> 	at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:178)
> 	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
> 	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
> 	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
> 	at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
> 	at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
> 	at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> 	at org.hibernate.event.def.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:407)
> 	at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:152)
> 	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:126)
> 	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
> 	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
> 	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
> 	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:228)
> 	... 20 more
> However the value is set correctly.

-- 
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