Link Details

Link 125632 thumbnail
User 111696 avatar

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.
  • 6
  • 1
  • 1651
  • 429

Comments

Add your comment
User 277934 avatar

jfpoilpret replied ago:

0 votes Vote down Vote up Reply

The blog is almost unreadable for source code (white on black, very narrow posts). Moreover, a better use of ThreadLocals would have used generics.

User 139727 avatar

JensSchauder replied ago:

0 votes Vote down Vote up Reply

How is this different from

setting the property hibernate.current_session_context_class to thread?
,

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (6)



Voters Against This Link (1)