javax.persistence.PersistenceException

org.hibernate.PersistentObjectException: detached entity passed to persist: org.hibernate.jpa.test.cascade.DetachAndContainsTest$Tooth

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web53

  • via Unknown by Réda Housni Alaoui,
  • via Unknown by Réda Housni Alaoui,
  • Stack trace

    • javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: org.hibernate.jpa.test.cascade.DetachAndContainsTest$Tooth at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1303) at org.hibernate.jpa.test.cascade.DetachAndContainsTest.testDetachCollectionElementAndFlush(DetachAndContainsTest.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: org.hibernate.jpa.test.cascade.DetachAndContainsTest$Tooth at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:124) at org.hibernate.internal.SessionImpl.firePersistOnFlush(SessionImpl.java:801) at org.hibernate.internal.SessionImpl.persistOnFlush(SessionImpl.java:794) at org.hibernate.engine.spi.CascadingActions$8.cascade(CascadingActions.java:340) at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:379) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:304) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:146) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:412) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:344) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:307) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:146) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:95) at org.hibernate.event.internal.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:150) at org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:141) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:74) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1224) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1300) ... 13 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    tvrmsmithtvrmsmith
    2 times, last one
    PilleoPilleo
    3 times, last one
    nasimknasimk
    Once,
    linxiaolonglinxiaolong
    3 times, last one
    HronomHronom
    3 times, last one
    11 more bugmates