com.jfw.database
Class Transaction

java.lang.Object
  extended by com.jfw.database.Transaction

public final class Transaction
extends java.lang.Object

Used with QueryGateway and StoredProcedureGateway in case of a transaction.
Manage the database connection used by the previous classes so is possible to make a full commit or rollbak.


Constructor Summary
Transaction()
          Use the default db resource from the jfw.properties.
Transaction(java.lang.String resourceName)
          Use the parameter resourceName as db resource.
 
Method Summary
 void close(boolean commit)
          Release the connection and commit or rollback the sql commands executed.
 java.sql.Connection getConnection()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transaction

public Transaction()
            throws java.lang.Exception
Use the default db resource from the jfw.properties.

Throws:
java.lang.Exception

Transaction

public Transaction(java.lang.String resourceName)
            throws java.lang.Exception
Use the parameter resourceName as db resource.

Parameters:
resourceName - the name of a resource as specified in the jfw.properties.
Throws:
java.lang.Exception
Method Detail

getConnection

public java.sql.Connection getConnection()

close

public void close(boolean commit)
           throws java.lang.Exception
Release the connection and commit or rollback the sql commands executed.

Parameters:
commit - if true do the commit, else do the rollback.
Throws:
java.lang.Exception