title: Hibernate: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session
body: <p>I wonder why this exception happens although it's assured by Hibernate get/query methods to retrieve objects that are already available inside the Hibernate session in case those objects are required repeatedly:</p>
  
  <pre><code>org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [x.y.z.MyObject#130062]
      at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:638)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:305)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:112)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
      at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
      at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
      at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:252)
      at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392)
      at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335)
      at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
      at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425)
      at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362)
      at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338)
      at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
      at org.hibernate.engine.Cascade.cascade(Cascade.java:161)
      at org.hibernate.engine.Cascade.cascade(Cascade.java:127)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.cascadeOnUpdate(DefaultSaveOrUpdateEventListener.java:376)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:350)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246)
      at org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:57)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
      at org.hibernate.impl.SessionImpl.fireUpdate(SessionImpl.java:742)
      at org.hibernate.impl.SessionImpl.update(SessionImpl.java:730)
      at org.hibernate.impl.SessionImpl.update(SessionImpl.java:722)
  </code></pre>