net.sourceforge.hivetranse.transaction.hibernate3
Class SessionsRepositoryImpl

java.lang.Object
  extended by net.sourceforge.hivetranse.transaction.hibernate3.SessionsRepositoryImpl
All Implemented Interfaces:
SessionsRepository

public class SessionsRepositoryImpl
extends java.lang.Object
implements SessionsRepository

Actual implementation class for SessionsRepository. Enlisted sessions and transactions are stored in a Map.

Author:
Jean-Francois Poilpret

Nested Class Summary
protected static class SessionsRepositoryImpl.TransactionEntry
           
 
Constructor Summary
SessionsRepositoryImpl()
           
 
Method Summary
protected  org.hibernate.HibernateException closeSession(java.lang.String id, org.hibernate.classic.Session session)
           
 void endAllSessions(boolean close, boolean commit)
          Terminate all sessions enlisted in the current transaction.
 org.hibernate.classic.Session getSession(java.lang.String id, org.hibernate.SessionFactory factory)
          Get a Session by its id for the current transaction (in the current thread).
protected  SessionsRepositoryImpl.TransactionEntry openSession(org.hibernate.SessionFactory factory)
           
protected  org.hibernate.HibernateException openTransaction(SessionsRepositoryImpl.TransactionEntry entry)
           
protected  org.hibernate.HibernateException terminateTransaction(java.lang.String id, org.hibernate.Transaction tx, boolean commit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionsRepositoryImpl

public SessionsRepositoryImpl()
Method Detail

getSession

public org.hibernate.classic.Session getSession(java.lang.String id,
                                                org.hibernate.SessionFactory factory)
Description copied from interface: SessionsRepository
Get a Session by its id for the current transaction (in the current thread). If this session does not exist yet then it is created by the underlying SessionFactory and it is "enlisted" into the current transaction.

Specified by:
getSession in interface SessionsRepository
Parameters:
id - unique identifier of the Session
factory - SessionFactory to be used to create new Session if needed
Returns:
the Hibernate session for this id and the current transaction

endAllSessions

public void endAllSessions(boolean close,
                           boolean commit)
Description copied from interface: SessionsRepository
Terminate all sessions enlisted in the current transaction. Used only by HibernateTransactionService.

Specified by:
endAllSessions in interface SessionsRepository
Parameters:
close - true if sessions should be closed immediately or not
commit - true if all sessions should be committed before closing, false if they should be rolled back

terminateTransaction

protected org.hibernate.HibernateException terminateTransaction(java.lang.String id,
                                                                org.hibernate.Transaction tx,
                                                                boolean commit)

closeSession

protected org.hibernate.HibernateException closeSession(java.lang.String id,
                                                        org.hibernate.classic.Session session)

openSession

protected SessionsRepositoryImpl.TransactionEntry openSession(org.hibernate.SessionFactory factory)

openTransaction

protected org.hibernate.HibernateException openTransaction(SessionsRepositoryImpl.TransactionEntry entry)