站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

JTATransaction (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.transaction
Class JTATransaction

java.lang.Object
  extended bynet.sf.hibernate.transaction.JTATransaction
All Implemented Interfaces:
Transaction

public class JTATransaction
extends Object
implements Transaction

Implements a basic transaction strategy for JTA transactions. Instances check to see if there is an existing JTA transaction. If none exists, a new transaction is started. If one exists, all work is done in the existing context. The following properties are used to locate the underlying UserTransaction:

hibernate.jndi.urlJNDI initial context URL
hibernate.jndi.classJNDI provider class
jta.UserTransactionJNDI name

Author:
Gavin King

Constructor Summary
JTATransaction(SessionImplementor session)
           
 
Method Summary
 void begin(InitialContext context, String utName, TransactionManager transactionManager)
           
 void commit()
          Flush the associated Session and end the unit of work.
 void rollback()
          Force the underlying transaction to roll back.
 boolean wasCommitted()
          Check if this transaction was successfully committed.
 boolean wasRolledBack()
          Was this transaction rolled back or set to rollback only?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTATransaction

public JTATransaction(SessionImplementor session)
Method Detail

commit

public void commit()
            throws HibernateException
Description copied from interface: Transaction
Flush the associated Session and end the unit of work. This method will commit the underlying transaction if and only if the transaction was initiated by this object.

Specified by:
commit in interface Transaction
Throws:
HibernateException

rollback

public void rollback()
              throws HibernateException
Description copied from interface: Transaction
Force the underlying transaction to roll back.

Specified by:
rollback in interface Transaction
Throws:
HibernateException

begin

public void begin(InitialContext context,
                  String utName,
                  TransactionManager transactionManager)
           throws HibernateException
Throws:
HibernateException

wasRolledBack

public boolean wasRolledBack()
                      throws TransactionException
Description copied from interface: Transaction
Was this transaction rolled back or set to rollback only?

Specified by:
wasRolledBack in interface Transaction
Returns:
boolean
Throws:
TransactionException

wasCommitted

public boolean wasCommitted()
                     throws TransactionException
Description copied from interface: Transaction
Check if this transaction was successfully committed. This method could return false even after successful invocation of commit().

Specified by:
wasCommitted in interface Transaction
Returns:
boolean
Throws:
TransactionException