| org.jpox.UserTransaction
UserTransaction | public interface UserTransaction (Code) | | UserTransaction is the interface exposed by JPOX to User Applications.
It allows proprietary JPOX extensions to be used by user applications.
To exemplify the usage of this interface, the below is a JDO snippet:
Transaction tx = pm.currentTransaction();
((UserTransaction)tx).setUseUpdateLock(true);
This interface does not make any distinction between user APIs, such as
JDO or JPA, neither the datastores, such as RDBMS or DB4O. Unsupported
operations will throw
UnsupportedOperationException .
User applications must be aware that the behaviour of this interface and
effects caused by invoking these operations may not be portable between
different datastores kinds (RBDMS, DB4O, LDAP, etc )or datastores of same
kind (RDBMS Oracle, RDBMS DB2, RDBMS MySQL, RDBMS Derby, etc).
|
Field Summary | |
int | TRANSACTION_NONE A constant indicating that transactions are not supported. | int | TRANSACTION_READ_COMMITTED A constant indicating that
dirty reads are prevented; non-repeatable reads and phantom
reads can occur. | int | TRANSACTION_READ_UNCOMMITTED A constant indicating that
dirty reads, non-repeatable reads and phantom reads can occur.
This level allows a row changed by one transaction to be read
by another transaction before any changes in that row have been
committed (a "dirty read"). | int | TRANSACTION_REPEATABLE_READ A constant indicating that
dirty reads and non-repeatable reads are prevented; phantom
reads can occur. | int | TRANSACTION_SERIALIZABLE A constant indicating that
dirty reads, non-repeatable reads and phantom reads are prevented. |
Method Summary | |
void | setTransactionIsolation(int isolation) Configure isolation level for the transaction
Some datastores do not support Isolation Level feature, and for such datastores
this setting is silently ignored. | void | setUseUpdateLock(boolean lock) Turn on/off serialized access to data fetch from datastore. | void | useUpdateLockOnFetch() Turn on serialized access to data fetch from datastore. |
TRANSACTION_NONE | int TRANSACTION_NONE(Code) | | A constant indicating that transactions are not supported.
|
TRANSACTION_READ_COMMITTED | int TRANSACTION_READ_COMMITTED(Code) | | A constant indicating that
dirty reads are prevented; non-repeatable reads and phantom
reads can occur. This level only prohibits a transaction
from reading a row with uncommitted changes in it.
|
TRANSACTION_READ_UNCOMMITTED | int TRANSACTION_READ_UNCOMMITTED(Code) | | A constant indicating that
dirty reads, non-repeatable reads and phantom reads can occur.
This level allows a row changed by one transaction to be read
by another transaction before any changes in that row have been
committed (a "dirty read"). If any of the changes are rolled back,
the second transaction will have retrieved an invalid row.
|
TRANSACTION_REPEATABLE_READ | int TRANSACTION_REPEATABLE_READ(Code) | | A constant indicating that
dirty reads and non-repeatable reads are prevented; phantom
reads can occur. This level prohibits a transaction from
reading a row with uncommitted changes in it, and it also
prohibits the situation where one transaction reads a row,
a second transaction alters the row, and the first transaction
rereads the row, getting different values the second time
(a "non-repeatable read").
|
TRANSACTION_SERIALIZABLE | int TRANSACTION_SERIALIZABLE(Code) | | A constant indicating that
dirty reads, non-repeatable reads and phantom reads are prevented.
This level includes the prohibitions in
TRANSACTION_REPEATABLE_READ and further prohibits the
situation where one transaction reads all rows that satisfy
a WHERE condition, a second transaction inserts a row that
satisfies that WHERE condition, and the first transaction
rereads for the same condition, retrieving the additional
"phantom" row in the second read.
|
setTransactionIsolation | void setTransactionIsolation(int isolation)(Code) | | Configure isolation level for the transaction
Some datastores do not support Isolation Level feature, and for such datastores
this setting is silently ignored.
Calling this in the middle of a transaction has behaviour undetermined
Parameters: isolation - level |
setUseUpdateLock | void setUseUpdateLock(boolean lock)(Code) | | Turn on/off serialized access to data fetch from datastore.
Calling this in the middle of a transaction will only affect data read after it.
Some datastores do not support Update Lock feature, and for such datastores
this setting is silently ignored.
Parameters: lock - whether to lock data or not |
useUpdateLockOnFetch | void useUpdateLockOnFetch()(Code) | | Turn on serialized access to data fetch from datastore.
Calling this in the middle of a transaction will only affect data read after it.
Some datastores do not support Update Lock feature, and for such datastores
this setting is silently ignored.
|
|
|