程序包 org.hibernate
接口 Transaction
-
- 所有超级接口:
javax.persistence.EntityTransaction
- 所有已知子接口:
TransactionImplementor
- 所有已知实现类:
TransactionImpl
public interface Transaction extends javax.persistence.EntityTransactionDefines the contract for abstracting applications from the configured underlying means of transaction management. Allows the application to define units of work, while maintaining abstraction from the underlying transaction implementation (eg. JTA, JDBC). A transaction is associated with aSessionand is usually initiated by a call toSharedSessionContract.beginTransaction(). 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 notion of a transaction. However, it is intended that there be at most one uncommitted transaction associated with a particularSessionat any time. Implementers are not intended to be thread-safe.- 作者:
- Anton van Straaten, Steve Ebersole
-
-
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 TransactionStatusgetStatus()Get the current local status of this transaction.intgetTimeout()Retrieve the transaction timeout set for this transaction.default voidmarkRollbackOnly()Make a best effort to mark the underlying transaction for rollback only.voidregisterSynchronization(javax.transaction.Synchronization synchronization)Register a user synchronization callback for this transaction.voidsetTimeout(int seconds)Set the transaction timeout for any transaction started by a subsequent call toEntityTransaction.begin()on this instance.
-
-
-
方法详细资料
-
getStatus
TransactionStatus getStatus()
Get the current local status of this transaction. This only accounts for the local view of the transaction status. In other words it does not check the status of the actual underlying transaction.- 返回:
- The current local status.
-
registerSynchronization
void registerSynchronization(javax.transaction.Synchronization synchronization) throws HibernateExceptionRegister a user synchronization callback for this transaction.- 参数:
synchronization- The Synchronization callback to register.- 抛出:
HibernateException- Indicates a problem registering the synchronization.
-
setTimeout
void setTimeout(int seconds)
Set the transaction timeout for any transaction started by a subsequent call toEntityTransaction.begin()on this instance.- 参数:
seconds- The number of seconds before a timeout.
-
getTimeout
int getTimeout()
Retrieve the transaction timeout set for this transaction. A negative indicates no timeout has been set.- 返回:
- The timeout, in seconds.
-
markRollbackOnly
default void markRollbackOnly()
Make a best effort to mark the underlying transaction for rollback only.
-
-