Somehow I missed this new feature in Hibernate 3.0.
Contextual sessions means that you can ask the SessionFactory for the current session. It will then return the session associated with your current JTA transaction. Of course, you need to have a JTA transaction, but that's not that big a deal. (For example, transactions with EJBs are JTA based)
This means that you don't need to pass the current session around in order to get access to it; you simply ask the SessionFactory. Of course, you need to get at the session factory - that can be done via JNDI very easily. And, of course, the session factory is threadsafe, whereas the session isn't.
Comments (1)
Yet another reason to love hibernate 3 !
Posted by Michael | April 14, 2005 7:07 PM
Posted on April 14, 2005 19:07