|Home >> All >> org >> hibernate >> [ context Javadoc ]|
org.hibernate.context: Javadoc index of package org.hibernate.context.
ThreadLocalSessionContext: A CurrentSessionContext impl which scopes the notion of current session by the current thread of execution. Unlike the JTA counterpart, threads do not give us a nice hook to perform any type of cleanup making it questionable for this impl to actually generate Session instances. In the interest of usability, it was decided to have this default impl actually generate a session upon first request and then clean it up after the org.hibernate.Transaction associated with that session is committed/rolled-back. In order for ensuring that happens, the sessions generated here are unusable until after Session.beginTransaction() ...
ManagedSessionContext: Represents a CurrentSessionContext the notion of a contextual session is managed by some external entity (generally some form of interceptor, etc). This external manager is responsible for scoping these contextual sessions appropriately binding/unbinding them here for exposure to the application through SessionFactory.getCurrentSession() > SessionFactory.getCurrentSession() 55 calls. Basically exposes two interfaces. First is the implementation of CurrentSessionContext which is then used by the SessionFactory.getCurrentSession() > SessionFactory.getCurrentSession() 55 calls. This portion is instance-based ...
JTASessionContext: An implementation of CurrentSessionContext which scopes the notion of a current session to a JTA transaction. Because JTA gives us a nice tie-in to clean up after ourselves, this implementation will generate Sessions as needed provided a JTA transaction is in effect. If a session is not already associated with the current JTA transaction at the time currentSession() 55 is called, a new session will be opened and it will be associated with that JTA transaction. Note that the sessions returned from this method are automatically configured with both the auto-flush 55 and auto-close 55 attributes set ...
CurrentSessionContext: Defines the contract for implementations which know how to scope the notion of a current session 55 . Implementations should adhere to the following: contain a constructor accepting a single argument of type org.hibernate.engine.SessionFactoryImplementor should be thread safe should be fully serializable Implementors should be aware that they are also fully responsible for cleanup of any generated current-sessions. Note that there will be exactly one instance of the configured CurrentSessionContext implementation per org.hibernate.SessionFactory .