org.hibernate.transaction
Class JDBCTransaction

java.lang.Object
  extended byorg.hibernate.transaction.JDBCTransaction
All Implemented Interfaces:
Transaction

public class JDBCTransaction
extends Object
implements Transaction

Implements a basic transaction strategy for JDBC connections.This is the default Transaction implementation used if none is explicitly specified.

Author:
Anton van Straaten, Gavin King

Constructor Summary
JDBCTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext)
           
 
Method Summary
 void begin()
           
 void commit()
          Flush the associated Session and end the unit of work.
 boolean isActive()
          Is this transaction still active?
 void registerSynchronization(Synchronization sync)
          Register a user synchronization callback for this transaction
 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

JDBCTransaction

public JDBCTransaction(JDBCContext jdbcContext,
                       TransactionFactory.Context transactionContext)
Method Detail

begin

public void begin()
           throws HibernateException
Throws:
HibernateException

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

wasRolledBack

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

Specified by:
wasRolledBack in interface Transaction
Returns:
boolean

wasCommitted

public boolean wasCommitted()
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

isActive

public boolean isActive()
Description copied from interface: Transaction
Is this transaction still active?

Specified by:
isActive in interface Transaction
Returns:
boolean

registerSynchronization

public void registerSynchronization(Synchronization sync)
                             throws HibernateException
Description copied from interface: Transaction
Register a user synchronization callback for this transaction

Specified by:
registerSynchronization in interface Transaction
Throws:
HibernateException