tapestry-hibernate provides a singleton hibernate session which can be
looked up from the registry.

This singleton is a proxy to a lazy-loaded, per-thread hibernate session
instance. All service methods invoked on the thread will share the same
hibernate session. You must call either Registry.cleanupThread() or
PerThreadManager.cleanup() to clean up the thread local if you are using
tapestry-hibernate outside of a normal request / response since this is not
managed by tapestry.

 There are two options for handling transactions

1. Annotate your service interface with @CommitAfter - tapestry-hibernate
will then commit() or abort() the transaction automatically.

2. Manage the transaction manually - Lookup the HibernateSessionManager
from the registry and call commit() or abort() yourself.

Reply via email to