| |
|
| com.lutris.appserver.server.sql.DBTransaction
DBTransaction | public interface DBTransaction (Code) | | Used to perform database transactions.
Example - adding a new user:
import org.enhydra.dods.DODS;
import com.lutris.appserver.server.sql.*;
DBTransaction transaction =
DODS.getDatabaseManager().createTransaction(DATABASE_NAME);
// NOTE: class CustomerDO implements Transaction { ... }
// NOTE: An Object ID is automatically calculated by the constructor.
CustomerDO customer = new CustomerDO();
customer.setFirstName("Santa");
customer.setLastName("Claus");
// ... set all other CustomerFields ...
//
// Now add the new object to the database.
//
try {
transaction.insert(customer);
transaction.commit();
System.out.println("Object ID is " + customer.get_OId());
}
catch (SQLException e) {
transaction.rollback();
throw e;
}
finally {
transaction.release();
}
author: Kyle Clark since: LBS1.8 version: $Revision: 1.1 $ |
createQuery | public DBQuery createQuery() throws SQLException(Code) | | Return a query for use with this TRANSACTION please!!!
The query object. exception: SQLException - if a SQL error occurs. |
delete | public void delete(Transaction transaction)(Code) | | Method to delete an object in the database.
Parameters: transaction - Object that implements transaction interface. |
getDO | public Transaction getDO(Transaction transaction)(Code) | | Method find a DO in the transaction
Parameters: transaction - Object that implements transaction interface. DO if the oid was in the transaction, null if it was notWebDocWf extension |
getDO | public Transaction getDO(Transaction transaction, int action)(Code) | | Method find a DO in the transaction
Parameters: transaction - Object that implements transaction interface. Parameters: action - if not NONE=0, the DO is found only woth the matching action DO if the oid was in the transaction, null if it was notWebDocWf extension |
getDatabaseName | public String getDatabaseName()(Code) | | Method return name of used database
name of used database |
handleException | public boolean handleException(SQLException e)(Code) | | Exception handeler. This object is should not be
used for subsequent queries if this method returns
false.
boolean True if the exception can be handeledand the object is still valid, false otherwise. |
insert | public void insert(Transaction transaction)(Code) | | Method to insert an object in the database.
Parameters: transaction - Object that implements transaction interface. |
preventCacheQueries | public boolean preventCacheQueries()(Code) | | |
release | public void release()(Code) | | 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).
|
setDatabaseName | public void setDatabaseName(String dbName)(Code) | | Method set name of used database
Parameters: dbName - name of used database |
update | public void update(Transaction transaction)(Code) | | Method to update an object in the database.
Parameters: transaction - Object that implements transaction interface. |
|
|
|