Enhydra 3.1 API

com.lutris.appserver.server.sql.standard
Class StandardDBTransaction

java.lang.Object
  |
  +--com.lutris.appserver.server.sql.standard.StandardDBTransaction
Direct Known Subclasses:
InformixDBTransaction, MsqlDBTransaction, OracleDBTransaction, SybaseDBTransaction

public class StandardDBTransaction
extends java.lang.Object
implements DBTransaction

Standard implementation of SQL database transaction.

Since:
LBS1.8
Version:
$Revision: 1.7.12.3 $
See Also:
DBTransaction

Constructor Summary
protected StandardDBTransaction(DBConnection conn)
          Construct a transaction object for use on the supplied dB connection.
 
Method Summary
 void commit()
          Method to commit upates.
 void delete(Transaction transaction)
          Method to delete an object in the database.
protected  void finalize()
          If this object has not been released, this method ensures that garbage collection does so.
 boolean handleException(java.sql.SQLException e)
          Exception handeler.
 void insert(Transaction transaction)
          Method to insert an object in the database.
protected  void logDebug(java.lang.String str)
          Logging.
 void release()
          Frees all resources consumed by this transaction Connections are returned to the connection pool.
 void rollback()
          Method to rollback changes.
 void update(Transaction transaction)
          Method to update an object in the database.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardDBTransaction

protected StandardDBTransaction(DBConnection conn)
                         throws java.sql.SQLException
Construct a transaction object for use on the supplied dB connection.
Parameters:
conn - The database connection to use.
Throws:
java.sql.SQLException - If a database access error occurs.
Method Detail

update

public void update(Transaction transaction)
Method to update an object in the database.
Specified by:
update in interface DBTransaction
Parameters:
transaction - Object that implements transaction interface.

delete

public void delete(Transaction transaction)
Method to delete an object in the database.
Specified by:
delete in interface DBTransaction
Parameters:
transaction - Object that implements transaction interface.

insert

public void insert(Transaction transaction)
Method to insert an object in the database.
Specified by:
insert in interface DBTransaction
Parameters:
transaction - Object that implements transaction interface.

commit

public void commit()
            throws java.sql.SQLException,
                   DBRowUpdateException
Method to commit upates.
Specified by:
commit in interface DBTransaction
Throws:
java.sql.SQLException - If a database access error occurs.
DBRowUpdateException - If a version error occurs.

rollback

public void rollback()
              throws java.sql.SQLException
Method to rollback changes.
Specified by:
rollback in interface DBTransaction
Throws:
java.sql.SQLException - If a database access error occurs.

release

public void release()
Frees all resources consumed by this transaction Connections are returned to the connection pool. Subsequent transactions via this object, will allocate a new set of resources (i.e. connection).
Specified by:
release in interface DBTransaction

handleException

public boolean handleException(java.sql.SQLException e)
Exception handeler. This object is should not be used for subsequent queries if this method returns false.
Specified by:
handleException in interface DBTransaction
Returns:
boolean True if the exception can be handeled and the object is still valid, false otherwise.

finalize

protected void finalize()
If this object has not been released, this method ensures that garbage collection does so.
Overrides:
finalize in class java.lang.Object

logDebug

protected void logDebug(java.lang.String str)
Logging. For debuging only, since it effects all Query objects.
Parameters:
str - The data to log.

Enhydra 3.1 API