galland wrote:
After getting an exception while deleting a bean, can I "reattach" the bean to the same session ?
[...]
If I close and reopen the session its OK but if possible I want keep the session.
It's not possible. If an exception occured within a session, you
must trash this session and create a new one.
See
http://www.hibernate.org/hib_docs/v3/re ... tices.html :
Quote:
Don't treat exceptions as recoverable.
This is more of a necessary practice than a "best" practice. When an exception occurs, roll back the Transaction and close the Session. If you don't, Hibernate can't guarantee that in-memory state accurately represents persistent state. As a special case of this, do not use Session.load() to determine if an instance with the given identifier exists on the database; use Session.get() or a query instead.