Quote:
Failed to lazily initialize a collection - no session or session was closed
I am using a prepared statement to bulk update the db. After processing,
I commit the connection, close the ps, and close the session. For sake of ex, the session obj id is 194. I open a new session, do some similar ps's, closing in the same way. This session is 203. Finally, I open a session, id 282, execute several HQL queries, and most work, except one, which gives the above error. After debugging, found that the failing HQL returns a collection with the session id 194, and it is closed. The named parameters to the suspect HQL derive from the current 282 session. The query uses session 282 and returns a list, but the objects appear from the previous session.
How should I destroy/cleanup after the old session to avoid this?
What is usually the culprit? I've checked for resources disposal, but I must be missing something.
Thanks