-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: TransientObjectException
PostPosted: Fri May 11, 2007 10:02 am 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
Hi,
I am getting a TransientObjectException, even though I persist the object.
Code:
// persiste the transient address
em.persist(address);
company.setAddress(address);
// wire both sides
address.setCompany(company);

em.persist(company);
// commit transaction
em.getTransaction().commit();



I am using this
Hibernate version:

Annotations: 3.2.0.GA
Core: version 3.2.3
EntityManager: 3.3.1.GA

I didn't get this exception using this hibernate version:

Annotations: Version: 3.2.0 CR1
Core: version 3.2 cr2
EntityManager: Version: 3.2.0.CR1

Here is the:
Full stack trace of any exception that occurs:
com.breako.ta3g.test.jpatests.POJOTests.testCreateCompleteCompanyjavax.persistence.RollbackException: Error while commiting the transaction
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
at com.breako.ta3g.test.jpatests.POJOTests.testCreateCompleteCompany(POJOTests.java:517)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at com.breako.ta.test.driver.TaTestResult$1.protect(TaTestResult.java:230)
at com.breako.ta.test.driver.TaTestResult.runProtected(TaTestResult.java:242)
at com.breako.ta.test.driver.TaTestResult.run(TaTestResult.java:233)
at com.breako.ta.test.driver.TaTestCase.run(TaTestCase.java:120)
at com.breako.ta.test.driver.console.Driver.doRun(Driver.java:137)
at com.breako.ta.test.driver.console.Driver.start(Driver.java:105)
at com.breako.ta.test.driver.AbstractDriver.initTA(AbstractDriver.java:369)
at com.breako.ta.test.driver.console.Driver.<init>(Driver.java:69)
at com.breako.ta.test.driver.console.Driver.main(Driver.java:73)
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.breako.ta3g.test.garage.Address.company -> com.breako.ta3g.test.garage.Company
at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:353)
at org.hibernate.engine.Cascade.cascade(Cascade.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
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.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
... 18 more


Any ideas what is going wrong?
Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.