public class EntityTransactionImpl extends Object implements javax.persistence.EntityTransaction
| Constructor and Description |
|---|
EntityTransactionImpl(com.j256.ormlite.support.ConnectionSource connectionSource)
Construct a ClassyEntityTransaction instance
|
EntityTransactionImpl(com.j256.ormlite.support.ConnectionSource connectionSource,
TransactionCallable onPreCommit)
Construct a ClassyEntityTransaction instance
|
EntityTransactionImpl(com.j256.ormlite.support.ConnectionSource connectionSource,
TransactionCallable onPreCommit,
Callable<Boolean> onPostCommit)
Construct a ClassyEntityTransaction instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Start the resource transaction.
|
void |
commit()
Commit the current transaction, writing any unflushed changes to the database.
|
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.
|
public static final String TAG
public EntityTransactionImpl(com.j256.ormlite.support.ConnectionSource connectionSource)
connectionSource - ConnectionSource to be used for database operationspublic EntityTransactionImpl(com.j256.ormlite.support.ConnectionSource connectionSource,
TransactionCallable onPreCommit)
connectionSource - ConnectionSource to be used for database operationsonPreCommit - Callable of return type Boolean to invoke on commit() calledpublic EntityTransactionImpl(com.j256.ormlite.support.ConnectionSource connectionSource,
TransactionCallable onPreCommit,
Callable<Boolean> onPostCommit)
connectionSource - ConnectionSource to be used for database operationsonPreCommit - Callable of return type Boolean to invoke on commit() calledonPostCommit - Callable of return type Boolean to invoke after commit() called and transaction committed.
OnPostCommit should just do clean up, auditing and other non-essential operations.
NOTE: The post-commit call will not occur if onPreCommit is called and fails. The onPreCommit parameter may be null.public void begin()
begin in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is true.public void commit()
commit in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is false.RollbackException - if the commit fails.public boolean getRollbackOnly()
getRollbackOnly in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is false.public boolean isActive()
isActive in interface javax.persistence.EntityTransactionjavax.persistence.PersistenceException - if an unexpected error condition is encountered.public void rollback()
rollback in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is false.javax.persistence.PersistenceException - if an unexpected error
condition is encountered.public void setRollbackOnly()
setRollbackOnly in interface javax.persistence.EntityTransactionIllegalStateException - if isActive() is false.This documentation is licensed by Andrew Bowley under the GPLv3 License.