org.compass.core.transaction
Interface TransactionFactory

All Known Implementing Classes:
AbstractJTATransactionFactory, AbstractTransactionFactory, HibernateSyncTransactionFactory, JTASyncTransactionFactory, LocalTransactionFactory, SpringSyncTransactionFactory, XATransactionFactory

public interface TransactionFactory

A factory of CompassTransaction that also manages CompassSession bounded to a transaction.

Author:
kimchy

Method Summary
 CompassTransaction beginTransaction(InternalCompassSession session)
          Begins a transaction for the proided session.
 void configure(Compass compass, CompassSettings settings)
          Configures the transaction factory.
 CompassSession getTransactionBoundSession()
          Retuns a transaction bound session, or null if none is found.
 CompassTransaction tryJoinExistingTransaction(InternalCompassSession session)
          If there is an outer running existing transaction, try and join it.
 

Method Detail

configure

void configure(Compass compass,
               CompassSettings settings)
               throws CompassException
Configures the transaction factory.

Throws:
CompassException

beginTransaction

CompassTransaction beginTransaction(InternalCompassSession session)
                                    throws CompassException
Begins a transaction for the proided session.

Throws:
CompassException

getTransactionBoundSession

CompassSession getTransactionBoundSession()
                                          throws CompassException
Retuns a transaction bound session, or null if none is found.

Throws:
CompassException

tryJoinExistingTransaction

CompassTransaction tryJoinExistingTransaction(InternalCompassSession session)
                                              throws CompassException
If there is an outer running existing transaction, try and join it. This method is called when opening a session and will ease the usage of Compass since there won't be a need to begin a transaction explicitly.

Note, this might end up working as if CompassSession.beginTransaction() was called, commit/rollback will not be called afterwards. Actually, beginTransaction might be called again for the same session.

If a transaction is joined, the transcation will be returned. If there is no existing transaction, null will be returned.

Throws:
CompassException


Copyright (c) 2004-2009 The Compass Project.