Well, it told you exactly what the problem is - your session is closed. Most likely cuases are: a) you closed the sesion earlier, b) the object is detached. Most likely, it's b.
Objects become detached when the session that loaded them closes. In order to use the object with a new session, you must call session.update() or session.lock() to bind the object to the session.
A great way to prevent this is to use the Open Session In View (search the site and the forums). If you're a GUI, then the Thread Local pattern might do, which the Open Session in View pattern is based on.
Also, buy Hibernate in Action. It has chapters on lazy objects, detached persistent objects, and the open session in view pattern.
Also try to identify if you are using the anti-patter: Session per operation.[/list]
|