public class JPAEntityTransaction extends Object implements javax.persistence.EntityTransaction
| Modifier and Type | Field and Description |
|---|---|
protected static org.datanucleus.util.Localiser |
LOCALISER
Localisation utility for output messages
|
| Constructor and Description |
|---|
JPAEntityTransaction(org.datanucleus.ExecutionContext ec)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertActive()
Convenience method to throw an exception if the transaction is not active.
|
protected void |
assertNotActive()
Convenience method to throw an exception if the transaction is active.
|
void |
begin()
Start a resource transaction.
|
void |
commit()
Commit the current transaction, writing any unflushed changes to the database.
|
void |
deregisterEventListener(org.datanucleus.TransactionEventListener listener)
Method to deregister a listener for transaction events.
|
boolean |
getRollbackOnly()
Determine whether the current transaction has been marked for rollback.
|
boolean |
isActive()
Indicate whether a transaction is in progress.
|
void |
registerEventListener(org.datanucleus.TransactionEventListener listener)
Method to register a listener for transaction events.
|
void |
rollback()
Roll back the current transaction.
|
void |
setOption(String option,
boolean value)
Convenience accessor for setting a transaction option.
|
void |
setOption(String option,
int value)
Convenience accessor for setting a transaction option.
|
void |
setOption(String option,
String value)
Convenience accessor for setting a transaction option.
|
void |
setRollbackOnly()
Mark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.
|
protected static final org.datanucleus.util.Localiser LOCALISER
public JPAEntityTransaction(org.datanucleus.ExecutionContext ec)
ec - The ExecutionContext providing the transaction.public boolean isActive()
isActive in interface javax.persistence.EntityTransactionjavax.persistence.PersistenceException - if an unexpected error condition is encountered.public void begin()
begin in interface javax.persistence.EntityTransactionIllegalStateException - if the transaction is activepublic void commit()
commit in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is false.javax.persistence.RollbackException - if the commit fails.public void rollback()
rollback in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is false.javax.persistence.PersistenceException - if an unexpected error condition is encountered.public boolean getRollbackOnly()
getRollbackOnly in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is false.public void setRollbackOnly()
setRollbackOnly in interface javax.persistence.EntityTransactionIllegalStateException - Thrown if the transaction is not activepublic void setOption(String option, int value)
option - option namevalue - The valuepublic void setOption(String option, boolean value)
option - option namevalue - The valuepublic void setOption(String option, String value)
option - option namevalue - The valueprotected void assertActive()
IllegalStateException - Thrown if the transaction is not active.protected void assertNotActive()
IllegalStateException - Thrown if the transaction is active.public void registerEventListener(org.datanucleus.TransactionEventListener listener)
listener - The listenerpublic void deregisterEventListener(org.datanucleus.TransactionEventListener listener)
listener - The listener to removeCopyright © 2012. All Rights Reserved.