org.compass.core
Interface CompassTransaction

All Known Subinterfaces:
InternalCompassTransaction
All Known Implementing Classes:
AbstractJTATransaction, AbstractTransaction, HibernateSyncTransaction, JTASyncTransaction, LocalTransaction, SpringSyncTransaction, XATransaction

public interface CompassTransaction

Allows the application to define units of work, while maintaining abstraction from the underlying transaction implementation (eg. JTA, Local).

Author:
kimchy
See Also:
CompassSession.beginTransaction(), TransactionFactory

Method Summary
 void commit()
          Ends the current unit of work.
 CompassSession getSession()
          Returns the current Compass transaction associated with this transaction.
 void rollback()
          Force the underlying transaction to roll back.
 boolean wasCommitted()
          Check if this transaction was successfully committed.
 boolean wasRolledBack()
          Was this transaction rolled back or set to rollback only?
 

Method Detail

commit

void commit()
            throws CompassException
Ends the current unit of work. The transaction will be commited only if it was initiated by the current transcation.

Throws:
CompassException

rollback

void rollback()
              throws CompassException
Force the underlying transaction to roll back.

Throws:
CompassException

wasRolledBack

boolean wasRolledBack()
                      throws CompassException
Was this transaction rolled back or set to rollback only?

Returns:
If the transaction was rolled backed
Throws:
CompassException

wasCommitted

boolean wasCommitted()
                     throws CompassException
Check if this transaction was successfully committed. This method could return false even after successful invocation of commit().

Returns:
If the transaction was committed
Throws:
CompassException

getSession

CompassSession getSession()
Returns the current Compass transaction associated with this transaction.



Copyright (c) 2004-2009 The Compass Project.