org.compass.gps.device.hibernate
Class HibernateSyncTransactionFactory

java.lang.Object
  extended by org.compass.core.transaction.AbstractTransactionFactory
      extended by org.compass.gps.device.hibernate.HibernateSyncTransactionFactory
All Implemented Interfaces:
TransactionFactory

public class HibernateSyncTransactionFactory
extends AbstractTransactionFactory

Integrates with Hibernate transaction managemnet abstraction and Compass transactions. Uses Hibernate support for "context session" including its support for registration of synchronizations with the current transaction.

Will start a Hibernate transaction of none exists, and will join an existing one if one is already in progress. If the Hibernate transcation is started by this transaction factory, it will also be committed by it.

In order to use the transaction factory, it must be configured with Compass, as well as calling setSessionFactory(org.hibernate.SessionFactory) before the Compass instance is created.

Author:
kimchy

Field Summary
 
Fields inherited from class org.compass.core.transaction.AbstractTransactionFactory
commitBeforeCompletion, compass, log
 
Constructor Summary
HibernateSyncTransactionFactory()
           
 
Method Summary
protected  InternalCompassTransaction doBeginTransaction(InternalCompassSession session, CompassTransaction.TransactionIsolation transactionIsolation)
           
protected  void doBindSessionToTransaction(CompassTransaction tr, CompassSession session)
           
protected  void doConfigure(CompassSettings settings)
           
protected  InternalCompassTransaction doContinueTransaction(InternalCompassSession session)
           
 SessionFactory getSessionFactory()
           
 CompassSession getTransactionBoundSession()
          Retuns a transaction bound session, or null if none is found.
protected  boolean isWithinExistingTransaction(InternalCompassSession session)
           
static void setSessionFactory(SessionFactory sessionFactory)
           
 void unbindSessionFromTransaction(Transaction transaction)
           
 
Methods inherited from class org.compass.core.transaction.AbstractTransactionFactory
beginTransaction, configure, tryJoinExistingTransaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateSyncTransactionFactory

public HibernateSyncTransactionFactory()
Method Detail

setSessionFactory

public static void setSessionFactory(SessionFactory sessionFactory)

doConfigure

protected void doConfigure(CompassSettings settings)
Overrides:
doConfigure in class AbstractTransactionFactory

isWithinExistingTransaction

protected boolean isWithinExistingTransaction(InternalCompassSession session)
                                       throws CompassException
Specified by:
isWithinExistingTransaction in class AbstractTransactionFactory
Throws:
CompassException

doBeginTransaction

protected InternalCompassTransaction doBeginTransaction(InternalCompassSession session,
                                                        CompassTransaction.TransactionIsolation transactionIsolation)
                                                 throws CompassException
Specified by:
doBeginTransaction in class AbstractTransactionFactory
Throws:
CompassException

doContinueTransaction

protected InternalCompassTransaction doContinueTransaction(InternalCompassSession session)
                                                    throws CompassException
Specified by:
doContinueTransaction in class AbstractTransactionFactory
Throws:
CompassException

getTransactionBoundSession

public CompassSession getTransactionBoundSession()
                                          throws CompassException
Description copied from interface: TransactionFactory
Retuns a transaction bound session, or null if none is found.

Throws:
CompassException

doBindSessionToTransaction

protected void doBindSessionToTransaction(CompassTransaction tr,
                                          CompassSession session)
                                   throws CompassException
Specified by:
doBindSessionToTransaction in class AbstractTransactionFactory
Throws:
CompassException

unbindSessionFromTransaction

public void unbindSessionFromTransaction(Transaction transaction)

getSessionFactory

public SessionFactory getSessionFactory()


Copyright (c) 2004-2008 The Compass Project.