Module org.eclipse.persistence.jpa
Class EntityTransactionImpl
java.lang.Object
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl
- All Implemented Interfaces:
EntityTransaction
JDK 1.5 version of the EntityTransaction. Differs from base version only in that
it takes a JDK 1.5 version of the EntityTransactionWrapper.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.TransactionFinalizerstatic booleanPERF: Avoid finalization if not required by the application, and finalizers have major concurrency affects.protected WeakHashMap<QueryImpl, QueryImpl> Keep a weak reference to the open queries that are executed in this entity manager.protected booleanprotected EntityTransactionWrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOpenQuery(QueryImpl query) Queries that leave the connection and are executed against this entity manager will be added here.voidbegin()Start the current transaction.protected voidOpen queries within a transaction will be closed on commit or rollback if they haven't already been closed.voidcommit()Commit the current transaction, writing any un-flushed changes to the database.Return the weak reference to the open queries.booleanDetermine whether the current transaction has been marked for rollback.booleanisActive()Check to see if the current transaction is in progress.voidrollback()Roll back the current transaction, discarding any changes that have happened in this transaction.voidMark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.
-
Field Details
-
openQueriesMap
Keep a weak reference to the open queries that are executed in this entity manager. -
wrapper
-
active
protected boolean active -
rollbackOnly
protected boolean rollbackOnly -
finalizer
protected org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.TransactionFinalizer finalizer -
isFinalizedRequired
public static boolean isFinalizedRequiredPERF: Avoid finalization if not required by the application, and finalizers have major concurrency affects.
-
-
Constructor Details
-
EntityTransactionImpl
-
-
Method Details
-
addOpenQuery
Queries that leave the connection and are executed against this entity manager will be added here. On rollback or commit any left over open queries should be closed. -
begin
public void begin()Start the current transaction. This can only be invoked ifisActive()returnsfalse.- Specified by:
beginin interfaceEntityTransaction- Throws:
IllegalStateException- if isActive() is true.
-
closeOpenQueries
protected void closeOpenQueries()Open queries within a transaction will be closed on commit or rollback if they haven't already been closed. -
commit
public void commit()Commit the current transaction, writing any un-flushed changes to the database. This can only be invoked ifisActive()returnstrue.- Specified by:
commitin interfaceEntityTransaction- Throws:
IllegalStateException- if isActive() is false.
-
rollback
public void rollback()Roll back the current transaction, discarding any changes that have happened in this transaction. This can only be invoked ifisActive()returnstrue.- Specified by:
rollbackin interfaceEntityTransaction- Throws:
IllegalStateException- if isActive() is false.
-
setRollbackOnly
public void setRollbackOnly()Mark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.- Specified by:
setRollbackOnlyin interfaceEntityTransaction- Throws:
IllegalStateException- if isActive() is false.
-
getOpenQueriesMap
Return the weak reference to the open queries. -
getRollbackOnly
public boolean getRollbackOnly()Determine whether the current transaction has been marked for rollback.- Specified by:
getRollbackOnlyin interfaceEntityTransaction- Throws:
IllegalStateException- if isActive() is false.
-
isActive
public boolean isActive()Check to see if the current transaction is in progress.- Specified by:
isActivein interfaceEntityTransaction
-