org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.gmv.sgi.agenda.core.modelo.contacto.UsuarioAgenda

hsqldb | fabiavmz2 | 9 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    hsqldb, Hibernate unsave transient instance

    hsqldb | 9 years ago | fabiavmz2
    org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.gmv.sgi.agenda.core.modelo.contacto.UsuarioAgenda
  2. 0

    Hibernate - One to many relationship and orphanRemoval cascade

    Stack Overflow | 7 years ago | Cedric Thiebault
    org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: Child
  3. 0

    TransientObjectException when saving object in Hibernate after adding to collection having `cascade="all, delete-orphan"`

    Stack Overflow | 12 months ago | Bjartr
    com.foo.server.services.db.exception.InvalidObjectException: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.foo.server.model.house.conditioning.Duct
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Two tables A and B where B is parent table and the relation between A and B is unidirectional many-to-one. mapping for A: <hibernate-mapping package="parms"> <class name="A" table="A" lazy="true" batch-size="20" select-before-update='true' > <id name="id" column="ID"> <generator class="increment"/> </id> <many-to-one name="b" column="Ba_ID" class="B" not-found="ignore" cascade="none" lazy="false" not-null="false" unique="false" /> <property name="place" column="PLACE"/> </class> mapping for B: <class name="B" table="B" lazy="true" batch-size="10" select-before-update="true"> <cache usage="read-write"/> <id name="id" column="B_ID" > <generator class="assigned"/> </id> <property name="programId" column="GROUP_ID" unique="true"/> </class> Also some of rows of table A have null values for column Ba_ID. Now retrieval of these rows which have null values for column Ba_ID works fine. And it retrieves a null relationship between the tables for these rows. Now when I try to update column PLACE. It tries to update column Ba_ID also and there it throws a TransientOBjectException. But nothing is being changed for that column. Also cascade is set to "none". Transaction scope code A a=_form.getA(id); a.setPlace("place"); sess.saveOrUpdate(a); tx.commit(); sess.close(); And the last SQL statement being tried to be executed is: UPDATE A set ......(all columns )..... where ID =? And the exception thrown is: [ERROR] AbstractFlushingEventListener - -Could not synchronize database state with session <org.hibernate.TransientObjectException: B> at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)

    Hibernate JIRA | 10 years ago | maxtor
    org.hibernate.TransientObjectException: B>
  6. 0

    Hibernate Community • View topic - TransientObjectException with `cascade="all, delete-orphan"`

    hibernate.org | 7 months ago
    org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.foo.server.model.house.conditioning.Duct

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.TransientObjectException

      object references an unsaved transient instance - save the transient instance before flushing: com.gmv.sgi.agenda.core.modelo.contacto.UsuarioAgenda

      at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved()
    2. Hibernate
      ForeignKeys.getEntityIdentifierIfNotUnsaved
      1. org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
      1 frame
    3. Hibernate
      PersistentSet.getOrphans
      1. org.hibernate.collection.AbstractPersistentCollection.getOrphans(AbstractPersistentCollection.java:889)
      2. org.hibernate.collection.PersistentSet.getOrphans(PersistentSet.java:51)
      2 frames
    4. Hibernate
      Cascade.cascade
      1. org.hibernate.engine.CollectionEntry.getOrphans(CollectionEntry.java:328)
      2. org.hibernate.engine.Cascade.deleteOrphans(Cascade.java:336)
      3. org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:318)
      4. org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
      5. org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
      6. org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
      7. org.hibernate.engine.Cascade.cascade(Cascade.java:248)
      7 frames
    5. Hibernate
      SessionImpl.saveOrUpdate
      1. org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:410)
      2. org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:299)
      3. org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
      4. org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
      5. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
      6. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
      7. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
      8. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
      9. org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:520)
      10. org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:513)
      10 frames
    6. Hibernate
      Cascade.cascade
      1. org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:134)
      2. org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
      3. org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
      4. org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
      5. org.hibernate.engine.Cascade.cascade(Cascade.java:248)
      5 frames
    7. Hibernate
      SessionImpl.saveOrUpdate
      1. org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:385)
      2. org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:242)
      3. org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
      4. org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
      5. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
      6. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
      7. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
      8. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
      9. org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:520)
      10. org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:513)
      10 frames
    8. Hibernate
      Cascade.cascade
      1. org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:134)
      2. org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
      3. org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
      4. org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
      5. org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:290)
      6. org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
      7. org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
      8. org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
      9. org.hibernate.engine.Cascade.cascade(Cascade.java:248)
      9 frames
    9. Hibernate
      SessionImpl.saveOrUpdate
      1. org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:410)
      2. org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:299)
      3. org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
      4. org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
      5. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
      6. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
      7. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
      8. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
      9. org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:520)
      10. org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:513)
      11. org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:509)
      11 frames
    10. Hibernate
      HibernateTemplate.saveOrUpdate
      1. org.springframework.orm.hibernate3.HibernateTemplate$18.doInHibernate(HibernateTemplate.java:693)
      2. org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
      3. org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:690)
      3 frames
    11. com.gmv.sgi
      BaseDAOService.save
      1. com.gmv.sgi.sbcore.dao.hibernate.AbstractDAOHibernate.save(AbstractDAOHibernate.java:34)
      2. com.gmv.sgi.sbcore.service.impl.BaseDAOService.save(BaseDAOService.java:43)
      2 frames
    12. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:585)
      3 frames
    13. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
      3 frames
    14. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      1 frame
    15. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
      2 frames
    16. Unknown
      $Proxy1.save
      1. $Proxy1.save(Unknown Source)
      1 frame
    17. com.gmv.sgi
      UsuarioHighService.save
      1. com.gmv.sgi.agenda.core.service.basic.UsuarioBasicService.save(UsuarioBasicService.java:80)
      2. com.gmv.sgi.agenda.core.service.high.UsuarioHighService.save(UsuarioHighService.java:194)
      2 frames
    18. com.sgi.agenda
      FirstTest.testSaveRecord
      1. com.sgi.agenda.core.test.FirstTest.testSaveRecord(FirstTest.java:226)
      1 frame
    19. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    20. JUnit
      OldTestClassRunner.run
      1. junit.framework.TestCase.runTest(TestCase.java:168)
      2. junit.framework.TestCase.runBare(TestCase.java:134)
      3. junit.framework.TestResult$1.protect(TestResult.java:110)
      4. junit.framework.TestResult.runProtected(TestResult.java:128)
      5. junit.framework.TestResult.run(TestResult.java:113)
      6. junit.framework.TestCase.run(TestCase.java:124)
      7. junit.framework.TestSuite.runTest(TestSuite.java:232)
      8. junit.framework.TestSuite.run(TestSuite.java:227)
      9. org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
      9 frames
    21. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
      1 frame
    22. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      5 frames