Class JDOTransaction
java.lang.Object
org.datanucleus.api.jdo.JDOTransaction
- All Implemented Interfaces:
javax.jdo.Transaction
Wrapper for the transaction for use by JDO.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) JDOPersistenceManagerJDO PersistenceManager.(package private) org.datanucleus.transaction.TransactionThe underlying transaction -
Constructor Summary
ConstructorsConstructorDescriptionJDOTransaction(JDOPersistenceManager pm, org.datanucleus.transaction.Transaction tx) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThrow an Exception if the underlying transaction is currently committing.protected voidAsserts that the transaction is not in use.voidbegin()Method to start the transaction.voidcommit()Method to commit the transaction.voidderegisterEventListener(org.datanucleus.transaction.TransactionEventListener listener) Method to deregister a listener for transaction events.Accessor for the current isolation level.booleanAccessor for nontransactionalRead settingbooleanAccessor for nontransactionalWrite settingbooleanAccessor for nontransactionalWrite settingbooleanAccessor for optimistic settingAccessor for the JDO PersistenceManagerbooleanAccessor for restoreValues settingbooleanAccessor for retainValues settingbooleanAccessor for whether to allow rollback onlyAccessor for whether to serialise any read objects in this transaction.Accessor for the synchronization (if any)booleanisActive()Accessor for whether the transaction is activevoidregisterEventListener(org.datanucleus.transaction.TransactionEventListener listener) Method to register a listener for transaction events.voidreleaseSavepoint(String name) Method to mark the current point as a savepoint with the provided name.voidrollback()Method to rollback the transactionvoidrollbackToSavepoint(String name) Method to mark the current point as a savepoint with the provided name.voidsetIsolationLevel(String level) Mutator for the isolation level.voidsetNontransactionalRead(boolean flag) Mutator for the nontransactionalRead setting.voidsetNontransactionalWrite(boolean flag) Mutator for the nontransactionalWrite setting.voidsetNontransactionalWriteAutoCommit(boolean flag) Mutator for the nontransactionalWrite auto-commit setting.voidsetOptimistic(boolean opt) Mutator for the optimistic settingvoidConvenience accessor for setting a transaction option.voidConvenience accessor for setting a transaction option.voidConvenience accessor for setting a transaction option.voidsetRestoreValues(boolean restore) Mutator for the restore values settingvoidsetRetainValues(boolean retain) Mutator for the retain values settingvoidMutator for the rollback-only settingvoidsetSavepoint(String name) Method to mark the current point as a savepoint with the provided name.voidsetSerializeRead(Boolean serialize) Mutator for whether to serialise any read objects.voidMutator for the Synchronisation
-
Field Details
-
tx
org.datanucleus.transaction.Transaction txThe underlying transaction -
pm
JDO PersistenceManager.
-
-
Constructor Details
-
JDOTransaction
Constructor- Parameters:
pm- The JDO PersistenceManagertx- The real transaction
-
-
Method Details
-
getPersistenceManager
Accessor for the JDO PersistenceManager- Specified by:
getPersistenceManagerin interfacejavax.jdo.Transaction- Returns:
- The JDO PM
-
isActive
public boolean isActive()Accessor for whether the transaction is active- Specified by:
isActivein interfacejavax.jdo.Transaction- Returns:
- Whether it is active
-
begin
public void begin()Method to start the transaction.- Specified by:
beginin interfacejavax.jdo.Transaction
-
commit
public void commit()Method to commit the transaction.- Specified by:
commitin interfacejavax.jdo.Transaction
-
rollback
public void rollback()Method to rollback the transaction- Specified by:
rollbackin interfacejavax.jdo.Transaction
-
getNontransactionalRead
public boolean getNontransactionalRead()Accessor for nontransactionalRead setting- Specified by:
getNontransactionalReadin interfacejavax.jdo.Transaction- Returns:
- The setting for nontransactionalRead
-
getNontransactionalWrite
public boolean getNontransactionalWrite()Accessor for nontransactionalWrite setting- Specified by:
getNontransactionalWritein interfacejavax.jdo.Transaction- Returns:
- The setting for nontransactionalWrite
-
getNontransactionalWriteAutoCommit
public boolean getNontransactionalWriteAutoCommit()Accessor for nontransactionalWrite setting- Returns:
- The setting for nontransactionalWrite
-
getOptimistic
public boolean getOptimistic()Accessor for optimistic setting- Specified by:
getOptimisticin interfacejavax.jdo.Transaction- Returns:
- The setting for optimistic
-
getRestoreValues
public boolean getRestoreValues()Accessor for restoreValues setting- Specified by:
getRestoreValuesin interfacejavax.jdo.Transaction- Returns:
- The setting for restoreValues
-
getRetainValues
public boolean getRetainValues()Accessor for retainValues setting- Specified by:
getRetainValuesin interfacejavax.jdo.Transaction- Returns:
- The setting for retainValues
-
getRollbackOnly
public boolean getRollbackOnly()Accessor for whether to allow rollback only- Specified by:
getRollbackOnlyin interfacejavax.jdo.Transaction- Returns:
- Whether to allow rollback only
-
getSynchronization
Accessor for the synchronization (if any)- Specified by:
getSynchronizationin interfacejavax.jdo.Transaction- Returns:
- The synchronization
-
setNontransactionalRead
public void setNontransactionalRead(boolean flag) Mutator for the nontransactionalRead setting.- Specified by:
setNontransactionalReadin interfacejavax.jdo.Transaction- Parameters:
flag- Whether to allow nontransactional read
-
setNontransactionalWrite
public void setNontransactionalWrite(boolean flag) Mutator for the nontransactionalWrite setting.- Specified by:
setNontransactionalWritein interfacejavax.jdo.Transaction- Parameters:
flag- Whether to allow nontransactional write
-
setNontransactionalWriteAutoCommit
public void setNontransactionalWriteAutoCommit(boolean flag) Mutator for the nontransactionalWrite auto-commit setting.- Parameters:
flag- Whether to auto-commit any non-tx writes
-
setOptimistic
public void setOptimistic(boolean opt) Mutator for the optimistic setting- Specified by:
setOptimisticin interfacejavax.jdo.Transaction- Parameters:
opt- Whether to use optimistic transactions
-
setRestoreValues
public void setRestoreValues(boolean restore) Mutator for the restore values setting- Specified by:
setRestoreValuesin interfacejavax.jdo.Transaction- Parameters:
restore- Whether to restore values
-
setRetainValues
public void setRetainValues(boolean retain) Mutator for the retain values setting- Specified by:
setRetainValuesin interfacejavax.jdo.Transaction- Parameters:
retain- Whether to retain values after commit
-
setRollbackOnly
public void setRollbackOnly()Mutator for the rollback-only setting- Specified by:
setRollbackOnlyin interfacejavax.jdo.Transaction
-
setSynchronization
Mutator for the Synchronisation- Specified by:
setSynchronizationin interfacejavax.jdo.Transaction- Parameters:
synch- The Synchronisation
-
setIsolationLevel
Mutator for the isolation level.- Specified by:
setIsolationLevelin interfacejavax.jdo.Transaction- Parameters:
level- The level- Throws:
javax.jdo.JDOUserException- if the required level is not supported.
-
getIsolationLevel
Accessor for the current isolation level.- Specified by:
getIsolationLevelin interfacejavax.jdo.Transaction- Returns:
- The isolation level.
-
setSavepoint
Method to mark the current point as a savepoint with the provided name.- Parameters:
name- Name of the savepoint.- Throws:
UnsupportedOperationException- if the underlying datastore doesn't support savepointsIllegalStateException- if no name is provided
-
releaseSavepoint
Method to mark the current point as a savepoint with the provided name.- Parameters:
name- Name of the savepoint.- Throws:
UnsupportedOperationException- if the underlying datastore doesn't support savepointsIllegalStateException- if no name is provided, or the name doesn't correspond to a known savepoint
-
rollbackToSavepoint
Method to mark the current point as a savepoint with the provided name.- Parameters:
name- Name of the savepoint.- Throws:
UnsupportedOperationException- if the underlying datastore doesn't support savepointsIllegalStateException- if no name is provided, or the name doesn't correspond to a known savepoint
-
assertNotCommitting
protected void assertNotCommitting()Throw an Exception if the underlying transaction is currently committing. -
assertNotInUse
protected void assertNotInUse()Asserts that the transaction is not in use. -
getSerializeRead
Accessor for whether to serialise any read objects in this transaction.- Specified by:
getSerializeReadin interfacejavax.jdo.Transaction- Returns:
- The setting for whether to serialise any read objects
-
setSerializeRead
Mutator for whether to serialise any read objects.- Specified by:
setSerializeReadin interfacejavax.jdo.Transaction- Parameters:
serialize- Whether to serialise any read objects in this transaction
-
setOption
Convenience accessor for setting a transaction option.- Parameters:
option- option namevalue- The value
-
setOption
Convenience accessor for setting a transaction option.- Parameters:
option- option namevalue- The value
-
setOption
-
registerEventListener
public void registerEventListener(org.datanucleus.transaction.TransactionEventListener listener) Method to register a listener for transaction events.- Parameters:
listener- The listener
-
deregisterEventListener
public void deregisterEventListener(org.datanucleus.transaction.TransactionEventListener listener) Method to deregister a listener for transaction events.- Parameters:
listener- The listener to remove
-