public interface Transaction
Transaction options include whether optimistic concurrency control should be used for the current transaction, and whether values should be retained in JDO instances after transaction completion.
Transaction completion methods have the same semantics as javax.transaction UserTransaction, and are valid only in the non-managed, non-distributed transaction environment.
Modifier and Type | Method and Description |
---|---|
void |
begin()
Begin a transaction.
|
void |
commit()
Commit the current transaction.
|
boolean |
getNontransactionalRead()
If this flag is set to true, then queries and navigation are allowed
without an active transaction
|
boolean |
getOptimistic()
Optimistic transactions do not hold data store locks until commit time.
|
PersistenceManager |
getPersistenceManager()
The Tranansaction instance is always associated with exactly one
PersistenceManager.
|
int |
getQueryTimeout()
Gets the number of seconds to wait for a query statement
to execute in the datastore associated with this Transaction instance
|
boolean |
getRestoreValues()
If true, at rollback time instances restore their field values.
|
boolean |
getRetainValues()
If true, at commit time instances retain their field values.
|
Synchronization |
getSynchronization()
The user-specified Synchronization instance for this Transaction instance.
|
int |
getUpdateTimeout()
Gets the number of seconds to wait for an update statement
to execute in the datastore associated with this Transaction instance
|
boolean |
isActive()
Returns whether there is a transaction currently active.
|
void |
rollback()
Roll back the current transaction.
|
void |
setNontransactionalRead(boolean flag)
If this flag is set to true, then queries and navigation are allowed
without an active transaction
|
void |
setOptimistic(boolean optimistic)
Optimistic transactions do not hold data store locks until commit time.
|
void |
setQueryTimeout(int timeout)
Sets the number of seconds to wait for a query statement
to execute in the datastore associated with this Transaction instance
|
void |
setRestoreValues(boolean restoreValues)
If true, at rollback instances restore their values and the instances
transition to persistent-nontransactional.
|
void |
setRetainValues(boolean retainValues)
If true, at commit instances retain their values and the instances
transition to persistent-nontransactional.
|
void |
setSynchronization(Synchronization sync)
The user can specify a Synchronization instance to be notified on
transaction completions.
|
void |
setUpdateTimeout(int timeout)
Sets the number of seconds to wait for an update statement
to execute in the datastore associated with this Transaction instance
|
void begin()
JDOUserException
- if a distributed transaction XAResource
is assigned to this TransactionsetOptimistic(boolean)
,
getOptimistic()
void commit()
void rollback()
boolean isActive()
void setRetainValues(boolean retainValues)
Setting this flag also sets the NontransactionalRead flag.
retainValues
- the value of the retainValues propertyboolean getRetainValues()
void setRestoreValues(boolean restoreValues)
restoreValues
- the value of the restoreValues propertyboolean getRestoreValues()
void setOptimistic(boolean optimistic)
optimistic
- the value of the Optimistic flag.boolean getOptimistic()
void setNontransactionalRead(boolean flag)
flag
- the value of the nontransactionalRead property.boolean getNontransactionalRead()
void setSynchronization(Synchronization sync)
The afterCompletion method is called after performing the data store commit operation.
sync
- the Synchronization instance to be notified; null for noneSynchronization getSynchronization()
void setQueryTimeout(int timeout)
timeout
- new timout value in seconds; zero means unlimitedint getQueryTimeout()
void setUpdateTimeout(int timeout)
timeout
- new timout value in seconds; zero means unlimitedint getUpdateTimeout()
PersistenceManager getPersistenceManager()
Copyright © 2019. All rights reserved.