IBM WebSphereTM eXtreme Scale, Release 8.5
API Specification

com.ibm.websphere.objectgrid.em
Interface EntityTransaction


public interface EntityTransaction

An EntityTransaction is associated with an EntityManager and is used to demarcate a transaction.

Use the EntityManager.getTransaction() method to retreive the EntityManager's EntityTransaction instance.

Each EntityManager and EntityTransaction are associated with the ObjectGrid Session. Transaction demarcation can be performed using either the EntityTransaction or ObjectGrid Session.

Since:
WAS XD 6.1
See Also:
EntityManager.getTransaction()

Method Summary
 void begin()
          Begin a new transaction.
 void commit()
          Commit the current transaction, flushing any uncommitted changes in the EntityManager's context to the cache.
 boolean getRollbackOnly()
          Determine whether the current transaction has been marked for rollback.
 boolean isActive()
          Indicate whether a transaction is in progress.
 void rollback()
          Roll back the current transaction.
 void setRollbackOnly()
          Mark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.
 

Method Detail

begin

void begin()
Begin a new transaction.

Throws:
IllegalStateException - if isActive() is true.
PersistenceException - if the transaction is unable to start.
See Also:
Session.begin()

commit

void commit()
Commit the current transaction, flushing any uncommitted changes in the EntityManager's context to the cache.

Throws:
IllegalStateException - if isActive() is false.
PersistenceException - if the commit fails.
See Also:
Session.commit()

rollback

void rollback()
Roll back the current transaction.

Throws:
IllegalStateException - if isActive() is false.
PersistenceException - if an unexpected error condition is encountered.
See Also:
Session.rollback()

isActive

boolean isActive()
Indicate whether a transaction is in progress.

Returns:
true if the transaction is currently active.
Throws:
PersistenceException - if an unexpected error condition is encountered.
See Also:
Session.isTransactionActive()

setRollbackOnly

void setRollbackOnly()
Mark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.

Throws:
IllegalStateException - if isActive() is false.
See Also:
Session.markRollbackOnly(Throwable)

getRollbackOnly

boolean getRollbackOnly()
Determine whether the current transaction has been marked for rollback.

Throws:
IllegalStateException - if isActive() is false.
See Also:
Session.isMarkedRollbackOnly()

IBM WebSphereTM eXtreme Scale, Release 8.5
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.