We're updating the issue view to help you get more done. 

Persist of transient entity in derived ID that is already in merge process throws javax.persistence.EntityExistsException

Description

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [org.hibernate.bugs.entity.ShoppingCart#cart1] at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:116) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162) at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:899) at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:858) at org.hibernate.engine.spi.CascadingActions$6.cascade(CascadingActions.java:261) at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:391) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:316) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:155) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:424) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:356) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:319) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:155) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:104) at org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:445) at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:239) at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:301) at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:170) at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:69) at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:866) at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:852)

Environment

None

Status

Assignee

Gail Badner

Reporter

Ihor Herasymenko

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

5.0.2
5.2.5

Priority

Major