FileDocCategorySizeDatePackage
LocalTransaction.javaAPI DocGlassfish v2 API4588Fri May 04 22:36:04 BST 2007com.sun.gjc.spi

LocalTransaction

public class LocalTransaction extends Object implements javax.resource.spi.LocalTransaction
LocalTransaction implementation for Generic JDBC Connector.
author
Evani Sai Surya Kiran
version
1.0, 02/08/03

Fields Summary
private ManagedConnection
mc
Constructors Summary
public LocalTransaction(ManagedConnection mc)
Constructor for LocalTransaction.

param
mc ManagedConnection that returns this LocalTransaction object as a result of getLocalTransaction

        this.mc = mc;
    
Methods Summary
public voidbegin()
Begin a local transaction.

throws
LocalTransactionException if there is an error in changing the autocommit mode of the physical connection

        //GJCINT
        mc.transactionStarted();
        try {
            mc.getActualConnection().setAutoCommit(false);
        } catch (java.sql.SQLException sqle) {
            throw new LocalTransactionException(sqle.getMessage());
        }
    
public voidcommit()
Commit a local transaction.

throws
LocalTransactionException if there is an error in changing the autocommit mode of the physical connection or committing the transaction

        try {
            mc.getActualConnection().commit();
            mc.getActualConnection().setAutoCommit(true);
        } catch (java.sql.SQLException sqle) {
            throw new LocalTransactionException(sqle.getMessage());
        }finally{
            //GJCINT
            mc.transactionCompleted();
        }
    
public voidrollback()
Rollback a local transaction.

throws
LocalTransactionException if there is an error in changing the autocommit mode of the physical connection or rolling back the transaction

        try {
            mc.getActualConnection().rollback();
            mc.getActualConnection().setAutoCommit(true);
        } catch (java.sql.SQLException sqle) {
            throw new LocalTransactionException(sqle.getMessage());
        }finally{
            //GJCINT
            mc.transactionCompleted();
        }