Enhydra 5.1 API

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

java.lang.Object
  |
  +--com.lutris.appserver.server.sql.standard.StandardDBTransaction
All Implemented Interfaces:
DBTransaction
Direct Known Subclasses:
InformixDBTransaction, OracleDBTransaction

public class StandardDBTransaction
extends java.lang.Object
implements DBTransaction

Standard implementation of SQL database transaction.

Since:
LBS1.8
Version:
$Revision: 1.2 $
Author:
Kyle Clark
See Also:
DBTransaction

Field Summary
protected  java.lang.String databaseName
          Name of used database
 
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.
 java.lang.String getDatabaseName()
          Method return name of used database
 CoreDO getDO(Transaction transaction)
          Method find a DO in the transaction
 CoreDO getDO(Transaction transaction, int action)
          Method find a DO in the transaction
 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 setDatabaseName(java.lang.String dbName)
          Method set name of used database
 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
 

Field Detail

databaseName

protected java.lang.String databaseName
Name of used database

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

getDO

public CoreDO getDO(Transaction transaction)
Description copied from interface: DBTransaction
Method find a DO in the transaction

Specified by:
getDO in interface DBTransaction
Parameters:
transaction - Object that implements transaction interface.
Returns:
DO if the oid was in the transaction, null if it was not WebDocWf extension

getDO

public CoreDO getDO(Transaction transaction,
                    int action)
Method find a DO in the transaction

Specified by:
getDO in interface DBTransaction
Parameters:
transaction - Object that implements transaction interface.
action - if not NONE=0, the DO is found only woth the matching action
Returns:
DO if the oid was in the transaction, null if it was not WebDocWf extension

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. contains WebDocWf bug fix, transaction needs to be cleared

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. contains WebDocWf bug fix, transaction needs to be cleared

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). contains WebDocWf bug fix, transaction needs to be cleared

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.

getDatabaseName

public java.lang.String getDatabaseName()
Method return name of used database

Specified by:
getDatabaseName in interface DBTransaction
Returns:
name of used database

setDatabaseName

public void setDatabaseName(java.lang.String dbName)
Method set name of used database

Specified by:
setDatabaseName in interface DBTransaction
Parameters:
dbName - name of used database

Enhydra 5.1 API