|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.youyounet.db.DBContext
A DBContext Object is usually used as a database transaction context within an application. It could also be subclassed to create a custom context, for example, a user session context in a web application, and store not only the database information, but also the user session information in the context.
| Field Summary | |
protected java.sql.Connection |
con
|
protected boolean |
isClosed
|
protected static java.util.logging.Logger |
log
|
| Constructor Summary | |
DBContext()
public constructor |
|
| Method Summary | |
void |
abort()
abort the transaction if the context is not closed and the connection is not closed. |
void |
commit()
commit the transaction if the context is not closed and the connection is not closed. |
java.sql.Connection |
getConnection()
get the DB connection object from the context |
boolean |
isClosed()
check if the context is closed |
void |
reset()
close the DB connection associated with this context if it's open |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static java.util.logging.Logger log
protected java.sql.Connection con
protected boolean isClosed
| Constructor Detail |
public DBContext()
| Method Detail |
public boolean isClosed()
public java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLException
public void abort()
throws java.sql.SQLException
java.sql.SQLException
public void commit()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void reset()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||