By bloid
via thediningphilosopher.blogspot.com
Published: Oct 14 2008 / 05:03
At long last here is the post I promised that uses ThreadLocal variables to handle Hibernate sessions and transactions. The rather long helper class contains methods to obtain the current session (if one doesn't already exist it creates one), close the session, obtain a transaction, commit the transaction and rollback.
SaveShareSend
Tags: frameworks, java
Comments
jfpoilpret replied ago:
The blog is almost unreadable for source code (white on black, very narrow posts). Moreover, a better use of ThreadLocals would have used generics.
JensSchauder replied ago:
How is this different from
setting the property hibernate.current_session_context_class to thread?
,
Voters For This Link (4)
Voters Against This Link (1)