-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: bugfix in hb2? saveOrUpdateCopy
PostPosted: Mon Apr 04, 2005 5:56 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 05, 2005 12:32 pm 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
sorry for pushing the thread ...

it would be great if someone could give me a hint, because i need this feature and upgrading to version 3.0 is not possible at the moment ...

thx!
curio


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.