Every resource-local transaction is associated with a Session and begins with
an explicit call to Session#beginTransaction(), or, equivalently, with
session.getTransaction().begin(), and ends with a call to commit()
or rollback().
A single session might span multiple transactions since the notion of a session
(a conversation between the application and the datastore) is of coarser granularity
than the concept of a database transaction. However, there is at most one uncommitted
transaction associated with a given Session at any time.
Note that this interface is never used to control container managed JTA transactions, and is not usually used to control transactions that affect multiple resources.
A Transaction object is not threadsafe.
Session#beginTransaction()
| Modifier and Type | Method and Description |
|---|---|
| public TransactionStatus | |
| public int | Returns: The timeout, in seconds.Retrieve the transaction timeout set for this instance. |
| public default void | |
| public void | registerSynchronization(Synchronization
The synchronization)Synchronization callback to register.Register a user |
| public void | setTimeout(int
The number of seconds before a timeout. seconds)Set the transaction timeout for any transaction started by any subsequent call to
|
| getStatus | back to summary |
|---|---|
| public TransactionStatus getStatus() Get the current status of this transaction. | |
| getTimeout | back to summary |
|---|---|
| public int getTimeout() Retrieve the transaction timeout set for this instance. A negative integer indicates that no timeout has been set.
| |
| markRollbackOnly | back to summary |
|---|---|
| public default void markRollbackOnly() Attempt to mark the underlying transaction for rollback only. | |
| registerSynchronization | back to summary |
|---|---|
| public void registerSynchronization(Synchronization synchronization) Register a user
| |
| setTimeout | back to summary |
|---|---|
| public void setTimeout(int seconds) Set the transaction timeout for any transaction started by any subsequent call to
| |