public class TransactionImpl extends Object implements Transaction
| Modifier and Type | Field and Description |
|---|---|
static int |
BMT_JDO |
static int |
BMT_UT |
static int |
CMT |
static int |
NON_MGD
Possible values of txType
|
static int |
TRAN_DEFAULT_TIMEOUT |
static int |
TRAN_MAX_THREADS |
| Constructor and Description |
|---|
TransactionImpl(PersistenceManager pm,
String username,
char[] password,
int seconds)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterCompletion(int st)
Called in the managed environment only for transaction completion
|
void |
beforeCompletion()
Called in the managed environment only for transaction completion
|
void |
begin()
Begin a transaction.
|
void |
begin(Transaction t)
Begin a transaction in managed environment
|
void |
commit()
Commit the transaction represented by this Transaction object
|
Connection |
getConnection()
Returns a Connection.
|
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()
Returns PersistenceManager associated with this transaction
|
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.
|
int |
getStatus()
Obtain the status of this transaction object.
|
Synchronization |
getSynchronization()
The user-specified Synchronization instance for this Transaction instance.
|
int |
getTransactionType() |
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 |
releaseConnection()
Close a connection.
|
void |
replaceConnection()
Replace a connection.
|
void |
rollback()
Rollback the transaction represented by this transaction object.
|
void |
setNontransactionalRead(boolean flag)
If this flag is set to true, then queries and navigation are allowed
without an active transaction
|
void |
setOptimistic(boolean flag)
Optimistic transactions do not hold data store locks until commit time.
|
void |
setPersistenceManager(PersistenceManager pm)
Set PersistenceManager
|
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 flag)
If true, at rollback instances restore their values and the instances
transition to persistent-nontransactional.
|
void |
setRetainValues(boolean flag)
If true, at commit instances retain their values and the instances
transition to persistent-nontransactional.
|
void |
setRollbackOnly()
Modify the transaction object such that the only possible outcome of
the transaction is to roll back.
|
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
|
static String |
statusString(int status)
Translates a javax.transaction.Status value into a string.
|
String |
toString()
Returns a string representation of this transaction object.
|
boolean |
verify(String username,
char[] password)
Verify that username and password are equal to ones stored before
|
public static final int TRAN_DEFAULT_TIMEOUT
public static final int TRAN_MAX_THREADS
public static final int NON_MGD
public static final int CMT
public static final int BMT_UT
public static final int BMT_JDO
public TransactionImpl(PersistenceManager pm, String username, char[] password, int seconds)
public void setPersistenceManager(PersistenceManager pm)
public PersistenceManager getPersistenceManager()
getPersistenceManager in interface Transactionpublic boolean isActive()
TransactionisActive in interface Transactionpublic void setRetainValues(boolean flag)
TransactionSetting this flag also sets the NontransactionalRead flag.
setRetainValues in interface Transactionflag - the value of the retainValues propertypublic boolean getRetainValues()
TransactiongetRetainValues in interface Transactionpublic void setRestoreValues(boolean flag)
TransactionsetRestoreValues in interface Transactionflag - the value of the restoreValues propertypublic boolean getRestoreValues()
TransactiongetRestoreValues in interface Transactionpublic void setNontransactionalRead(boolean flag)
TransactionsetNontransactionalRead in interface Transactionflag - the value of the nontransactionalRead property.public boolean getNontransactionalRead()
TransactiongetNontransactionalRead in interface Transactionpublic void setQueryTimeout(int timeout)
setQueryTimeout in interface Transactiontimeout - new timout value in seconds; zero means unlimitedpublic int getQueryTimeout()
getQueryTimeout in interface Transactionpublic void setUpdateTimeout(int timeout)
setUpdateTimeout in interface Transactiontimeout - new timout value in seconds; zero means unlimitedpublic int getUpdateTimeout()
getUpdateTimeout in interface Transactionpublic void setOptimistic(boolean flag)
TransactionsetOptimistic in interface Transactionflag - the value of the Optimistic flag.public boolean getOptimistic()
TransactiongetOptimistic in interface Transactionpublic void setSynchronization(Synchronization sync)
TransactionThe afterCompletion method is called after performing the data store commit operation.
setSynchronization in interface Transactionsync - the Synchronization instance to be notified; null for nonepublic Synchronization getSynchronization()
TransactiongetSynchronization in interface Transactionpublic int getTransactionType()
public boolean verify(String username, char[] password)
username - as Stringpassword - as Stringpublic void begin()
begin in interface TransactionTransaction.setOptimistic(boolean),
Transaction.getOptimistic()public void begin(Transaction t)
public void commit()
commit in interface Transactionpublic void beforeCompletion()
beforeCompletion in interface Synchronizationpublic void afterCompletion(int st)
afterCompletion in interface Synchronizationpublic void rollback()
rollback in interface Transactionpublic void setRollbackOnly()
public int getStatus()
public static String statusString(int status)
status - Status object to translate.public Connection getConnection()
public void replaceConnection()
public void releaseConnection()
Copyright © 2019. All rights reserved.