Hi,
I have a problem where two different objects (A & B) are referring to a third object (C) and B is contained in A.
A------- C
|
B------- C
Save is fired on A. I use lifecycle methods on A to save B. i.e. in lifecycle method "onUpdate" of A, I have written
[b]session.saveOrUpdate(getB())[/b]
While saving it throws exception
Caused by: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: C
I tried writing
[b]session.flush() [/b]
immediaely after
[b]session.saveOrUpdate(getB())[/b]
Still the same exception is thrown.
I need help ASAP. Thanking in advance.
Regards
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
[b]Hibernate version:[/b]
[b]Mapping documents:[/b]
[b]Code between sessionFactory.openSession() and session.close():[/b]
[b]Full stack trace of any exception that occurs:[/b]
[b]Name and version of the database you are using:[/b]
[b]The generated SQL (show_sql=true):[/b]
[b]Debug level Hibernate log excerpt:[/b]