|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Database
A convenience wrapper around database related components.
Use this component to reduce the number of required constructor parameters in your database dependant components, and make sure that they'll access the right data source, if you are using the ThreadDataSource decorator.
| Method Summary | |
|---|---|
boolean |
beginTransaction()
Begin the transaction, if there is none active. |
void |
commitTransaction(boolean controller)
Commit the transaction, if the caller is the controller. |
Connection |
getConnection()
Returns a database Connection produced by the DataSource. |
Connection |
getConnection(String user,
String password)
Returns a database Connection produced by the DataSource. |
long |
getNextId(String table)
Get the next row identifier for the table. |
void |
rollbackTransaction(boolean controller)
Rollback the transaction, if the caller is the controller. |
void |
setTransactionTimeout(int seconds)
Sets the transaction timeout for the current transaction. |
| Method Detail |
|---|
Connection getConnection()
throws SQLException
SQLException - if the conneciton could not be obtained.
Connection getConnection(String user,
String password)
throws SQLException
user - the user to connect as.password - the user's password.
SQLException - if the conneciton could not be obtained.
long getNextId(String table)
throws SQLException
table - the table name.
SQLException - if the id could not be generated.
void setTransactionTimeout(int seconds)
throws SQLException
seconds - the requested length of timeout period in seconds.
SQLException - if the timeout could not be set.
boolean beginTransaction()
throws SQLException
true if the requestor become the controler.
SQLException - if the operation fails.
void commitTransaction(boolean controller)
throws SQLException
controller - true if the caller is the controler.
SQLException - if the commit fails.
void rollbackTransaction(boolean controller)
throws SQLException
controller - true if the caller is the controler.
SQLException - if the rollback fails.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||