Hibernate version: 2.1.8
Full stack trace of any exception that occurs:
Code:
net.sf.hibernate.NonUniqueObjectException: a different object with the same iden
tifier value was already associated with the session: 1108, of class:
de.test.ClassC
at net.sf.hibernate.impl.SessionImpl.checkUniqueness(SessionImpl.java:16
87)
at net.sf.hibernate.impl.SessionImpl.doUpdateMutable(SessionImpl.java:14
53)
at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1480)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1403)
at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)
at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2
701)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:22
71)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2260)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.j
ava:61)
Name and version of the database you are using:
IBM DB2 on AS400 (V5R2)
Hi everybody,
the changelog of version 2.1.8 says "* fixed a bad bug in saveOrUpdateCopy() that caused NonUniqueObjectExceptions", but i still get that exception in case of using 'saveOrUpdateCopy' with Collections.
My situation (i could add a test case to JIRA i think if there's hope that it will be fixed in hb2) is the following:
ClassA has a 1:n - relationship to ClassB (bidirectional)
ClassA has a 1:n - relationship to ClassC (bidirectional)
ClassB has a 1:n - relationship to ClassC (bidirectional)
I'm loading ClassA and ClassB/ClassC from db .. that works perfectly.
In the next step the HibernateSession gets closed.
Some times later a new HibernateSession will be created and i'm using 'session.lock(origClassA, LockMode.NONE);' to reRegister the original loaded ClassA (a complete clone of the loaded values) because i need those values for a history-log and optimistic lock without version-columns (optimistic-lock='all').
But i'm still getting the 'NonUniqueObjectException' when saving the changed object with 'saveOrUpdateCopy' ...
Because it's mentioned in the changelog that this bug was fixed, i think i'm doing something terrible wrong ....
Could someone please give a hint?
thanx in advance!
gtx
curio