Hi,
I am looking for a way to work on the same object within two sessions. One session is the reader session for lazy=true objects. In that session write attempts are never made (if I get it right from the reference manual, a session is unusable after an exception has occurred, so I do not want write attempts to corrupt my reader session which in turn would affect lazy fetching). The other session is the writer session which is opened on demand. When an exception occurs, it is closed and forgotten.
However, when I try to persist an object loaded from the first session thru the second session I get an "Illegal attempt to associate a collection with two open sessions".
I could simply disable lazy fetching and close the first session after loading. But the object structures I am loading are large. I consider disabling lazy fetching only as a last resort.
Is there a better solution for that problem?
Hibernate version: 3.1
Name and version of the database you are using: PostgreSQL 8
|