Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.jpa.transaction

public Class EntityTransactionImpl

extends Object
implements EntityTransaction
Class Inheritance
All Implemented Interfaces
jakarta.persistence.EntityTransaction
Imports
java.util.Map, .WeakHashMap, jakarta.persistence.RollbackException, org.eclipse.persistence.exceptions.TransactionException, org.eclipse.persistence.internal.jpa.QueryImpl, org.eclipse.persistence.internal.jpa.transaction.EntityTransactionWrapper, org.eclipse.persistence.internal.localization.ExceptionLocalization

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
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
protected boolean
protected EntityTransactionImpl.TransactionFinalizer
public static boolean
isFinalizedRequired

PERF: Avoid finalization if not required by the application, and finalizers have major concurrency affects.

protected WeakHashMap<QueryImpl, QueryImpl>
openQueriesMap

Keep a weak reference to the open queries that are executed in this entity manager.

protected boolean
protected EntityTransactionWrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addOpenQuery(QueryImpl query)

Queries that leave the connection and are executed against this entity manager will be added here.

public void
begin()

Implements jakarta.persistence.EntityTransaction.begin.

Start the current transaction.
protected void
closeOpenQueries()

Open queries within a transaction will be closed on commit or rollback if they haven't already been closed.

public void
commit()

Implements jakarta.persistence.EntityTransaction.commit.

Commit the current transaction, writing any un-flushed changes to the database.
protected Map<QueryImpl, QueryImpl>
getOpenQueriesMap()

Return the weak reference to the open queries.

public boolean
getRollbackOnly()

Implements jakarta.persistence.EntityTransaction.getRollbackOnly.

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

Implements jakarta.persistence.EntityTransaction.isActive.

Check to see if the current transaction is in progress.
public void
rollback()

Implements jakarta.persistence.EntityTransaction.rollback.

Roll back the current transaction, discarding any changes that have happened in this transaction.
public void
setRollbackOnly()

Implements jakarta.persistence.EntityTransaction.setRollbackOnly.

Mark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activeback to summary
protected boolean active
finalizerback to summary
protected EntityTransactionImpl.TransactionFinalizer finalizer
isFinalizedRequiredback to summary
public static boolean isFinalizedRequired

PERF: Avoid finalization if not required by the application, and finalizers have major concurrency affects.

openQueriesMapback to summary
protected WeakHashMap<QueryImpl, QueryImpl> openQueriesMap

Keep a weak reference to the open queries that are executed in this entity manager.

rollbackOnlyback to summary
protected boolean rollbackOnly
wrapperback to summary
protected EntityTransactionWrapper wrapper

Constructor Detail

EntityTransactionImplback to summary
public EntityTransactionImpl(EntityTransactionWrapper wrapper)

Method Detail

addOpenQueryback to summary
public void addOpenQuery(QueryImpl query)

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.

beginback to summary
public void begin()

Implements jakarta.persistence.EntityTransaction.begin.

Start the current transaction. This can only be invoked if isActive() returns false.

Annotations
@Override
Exceptions
IllegalStateException:
if isActive() is true.
closeOpenQueriesback to summary
protected void closeOpenQueries()

Open queries within a transaction will be closed on commit or rollback if they haven't already been closed.

commitback to summary
public void commit()

Implements jakarta.persistence.EntityTransaction.commit.

Commit the current transaction, writing any un-flushed changes to the database. This can only be invoked if isActive() returns true.

Annotations
@Override
Exceptions
IllegalStateException:
if isActive() is false.
getOpenQueriesMapback to summary
protected Map<QueryImpl, QueryImpl> getOpenQueriesMap()

Return the weak reference to the open queries.

getRollbackOnlyback to summary
public boolean getRollbackOnly()

Implements jakarta.persistence.EntityTransaction.getRollbackOnly.

Determine whether the current transaction has been marked for rollback.

Returns:boolean

Doc from jakarta.persistence.EntityTransaction.getRollbackOnly.

boolean indicating whether the transaction has been marked for rollback

Annotations
@Override
Exceptions
IllegalStateException:
if isActive() is false.
isActiveback to summary
public boolean isActive()

Implements jakarta.persistence.EntityTransaction.isActive.

Check to see if the current transaction is in progress.

Returns:boolean

Doc from jakarta.persistence.EntityTransaction.isActive.

boolean indicating whether transaction is in progress

Annotations
@Override
rollbackback to summary
public void rollback()

Implements jakarta.persistence.EntityTransaction.rollback.

Roll back the current transaction, discarding any changes that have happened in this transaction. This can only be invoked if isActive() returns true.

Annotations
@Override
Exceptions
IllegalStateException:
if isActive() is false.
setRollbackOnlyback to summary
public void setRollbackOnly()

Implements jakarta.persistence.EntityTransaction.setRollbackOnly.

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

Annotations
@Override
Exceptions
IllegalStateException:
if isActive() is false.
org.eclipse.persistence.internal.jpa.transaction back to summary

pack-priv Class EntityTransactionImpl.TransactionFinalizer

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.TransactionFinalizer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected void
finalize()

Overrides java.lang.Object.finalize.

Here incase a user does not commit or rollback an enityTransaction but just throws it away.
Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TransactionFinalizerback to summary
pack-priv TransactionFinalizer()

Method Detail

finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Here incase a user does not commit or rollback an enityTransaction but just throws it away. If we do not rollback the txn the connection will go back into the pool.

Annotations
@Override
Exceptions
Throwable:

Doc from java.lang.Object.finalize.

the Exception raised by this method