[hibernate-issues] [Hibernate-JIRA] Reopened: (HHH-1870) org.hibernate.TransientObjectException: object references an unsaved transient

Gail Badner (JIRA) noreply at atlassian.com
Fri Jan 27 03:53:10 EST 2012


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

Gail Badner reopened HHH-1870:
------------------------------


Re-opening because this issue still exists.

> org.hibernate.TransientObjectException: object references an unsaved transient 
> -------------------------------------------------------------------------------
>
>                 Key: HHH-1870
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1870
>             Project: Hibernate ORM
>          Issue Type: Bug
>         Environment: Hibernate 3.2.0 RC 2 from SVN tunk 2006/06/30
>            Reporter: Sergey Vladimirov
>            Assignee: Gail Badner
>             Fix For: 4.1.0
>
>         Attachments: manytoonelazy.zip, patch.txt
>
>
> JUnit test case shows strange error on commit():
>             Session session = sessionFactory.openSession();
>             Transaction transaction = session.beginTransaction();
>             BeanB beanB = new BeanB();
>             beanB.setId(1);
>             session.save(beanB);
>             beanB = (BeanB) session.load(BeanB.class, 1);
>             BeanA beanA = new BeanA();
>             beanA.setId(2);
>             beanA.setParent((BeanB) session.load(BeanB.class, 1));
>             session.save(beanA);
>             transaction.commit();
>             session.close();
> org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: ru.arptek.arpsite.data.manytoonelazy.BeanA.parent -> ru.arptek.arpsite.data.manytoonelazy.BeanB
> 	at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:273)
> 	at org.hibernate.engine.Cascade.cascade(Cascade.java:257)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
> 	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
> 	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
> 	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
> 	at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:135)
> 	at ru.arptek.arpsite.data.manytoonelazy.TestWithoutCache.testFind(TestWithoutCache.java:57)
> 	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 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:128)
> 	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)
> Temporary patch included. May be it is brokes other issue.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list