Listener to init and cleanup the hibernate session automatically, implement
the Hibernate's "Open Session In View" pattern without JTA support. This listener
is used with HibernateUtil, or it will not work.

Default StaleObjectStateException handler. This implementation
does not implement optimistic concurrency control! It simply rollback
the transaction.

Application developer might want to extends this class and override
this method to do other things like compensate for any permanent changes
during the conversation, and finally restart business conversation.
Or maybe give the user of the application a chance to merge some of his
work with fresh data... what can be done here depends on the applications
design.

Parameters:

exec the exection to clean up.

ex the StaleObjectStateException being thrown (and not handled) during the execution

Default other exception (other than StaleObjectStateException) handler.
This implementation simply rollback the transaction.

Application developer might want to extends this class and override
this method to do other things like compensate for any permanent changes
during the conversation, and finally restart business conversation...
what can be done here depends on the applications design.

Parameters:

exec the exection to clean up.

ex the Throwable other than StaleObjectStateException being thrown (and not handled) during the execution