Is that so? If this is true, then it's news to me. This would explain why I've sometimes been getting session errors, and sometimes shared reference errors.
Presumably I can share as many references as I like if I can sort out the session situation?
It's not what seems obvious to me, based upon what I've experienced though. I would expect that the statement:
Code:
session.createCriteria(clazz).list();
would all occurr within the same session, but I was getting a "collection is not associated with any session" because that class contains a list of references to all instances of itself - meaning each object refers to the same list - a perfectly feasible thing in "unpersisted" java. (If I add a restriction to the above criteria, the exception becomes "Found shared references to a collection".