net.sourceforge.hivetranse.transaction.hibernate3
Class SessionsRepositoryImpl
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SessionsRepositoryImpl
public SessionsRepositoryImpl()
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 Sessionfactory
- 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 notcommit
- 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)