Where is the best way to keep the current opened Hibernate Session ?
-in the HttpSession of each user ?
-in a singleton ?
-...

When to close this Session ?
-after each request ?
-when the HttpSession closes ?
-...

Acutally, I have put the getHibernateSession() on a ActionFormBase.
After each SQL action (load, find...) I close the Session.
I don't believe this is a good design and would like to improve it.

This is actually how Hibernate is meant to be used. The session lifespan is supposed to approximate that of a transaction.


Here's one resource. http://blog.hibernate.org/cgi-bin/blosxom.cgi/2004/01/27

Another (where I learned this originally) is the free sample chapter of O'Reilly's "Hibernate Developer's Notebook" (see http://www.oreilly.com/catalog/0596006969/ for download)

Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining."
-- Jef Raskin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to