|
|||||||||
| Home >> All >> com >> lutris >> appserver >> server >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.lutris.appserver.server.sql
Interface DBTransaction

- public interface DBTransaction
Used to perform database transactions.
Example - adding a new user:
import com.lutris.appserver.server.LBS;
import com.lutris.appserver.server.sql.*;
DBTransaction transaction =
LBS.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.getOId());
}
catch (SQLException e) {
transaction.rollback();
throw e;
}
finally {
transaction.release();
}
- Since:
- LBS1.8
- Version:
- $Revision: 1.17.12.1 $
| Method Summary | |
void |
commit()
Method to commit upates. |
void |
delete(Transaction transaction)
Method to delete an object in the database. |
boolean |
handleException(java.sql.SQLException e)
Exception handeler. |
void |
insert(Transaction transaction)
Method to insert an object in the database. |
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. |
| Method Detail |
update
public void update(Transaction transaction)
- Method to update an object in the database.
delete
public void delete(Transaction transaction)
- Method to delete an object in the database.
insert
public void insert(Transaction transaction)
- Method to insert an object in the database.
commit
public void commit()
throws java.sql.SQLException,
DBRowUpdateException
- Method to commit upates.
rollback
public void rollback()
throws java.sql.SQLException
- Method to rollback changes.
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).
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.
|
|||||||||
| Home >> All >> com >> lutris >> appserver >> server >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC