Hi,
I am having bit of trouble saving objects (objects contains collection of another objects and hibernate's uuid is used for id) in another hibernate session. (sessions points to different database and objects need different ids in each database)
I save objects in one hibernate session then I call:
session1.clear();
session1.close();
sessionFactory1.close();
After that I initialize second session factory and opens new session from it.
If I call save now, I get error:
org.hibernate.HibernateException: Don't change the reference to a collection with cascade="all-delete-orphan":
But before calling save in session2, if I call
session2.clear();
Then I get error:
org.hibernate.HibernateException: Found two representations of same collection:
As from doc it looks that session.clear() clears the first level cache and sessionFactory.close() removes second level cache (if any). Any idea whats going on?
As this is a new session, so I don't think that this (
http://forum.hibernate.org/viewtopic.ph ... highlight= ) should apply in my case.
Any suggestions?
Thanks.
Hibernate version:3.1.2