|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Provides the base methods for defining database transactions.
Field Summary | |
static int |
LOCK_NONE
Indicates that the row locking mode is Manual. |
static int |
LOCK_OPTIMISTIC
Indicates that the row locking mode is Automatic and Optimistic. |
static int |
LOCK_PESSIMISTIC
Indicates that the row locking mode is Automatic and Pessimistic. |
Method Summary | |
void |
commit()
Updates the database with the modified data, so that it becomes visible to all users of the database. |
void |
connect(java.lang.String url)
Attempts to establish a connection to a database identified by a URL. |
void |
connect(java.lang.String url,
java.util.Properties info)
Attempts to establish a connection to a database identified by a URL. |
void |
connect(java.lang.String url,
java.lang.String user,
java.lang.String password)
Attempts to establish a connection to a database identified by a URL. |
java.lang.Object |
createRef(java.lang.String structName,
byte[] data)
Internal: Applications should not use this method. |
void |
disconnect()
Terminates the database connection. |
java.lang.String |
dumpQueryResult(java.lang.String query,
java.lang.String dumpClassName,
java.lang.String[] data)
Internal: Applications should not use this method. |
int |
executeCommand(java.lang.String command)
Executes a SQL command in the database under the current transaction. |
int |
getLockingMode()
Gets the locking mode for this transaction. |
boolean |
isConnected()
Checks the database connection. |
boolean |
isDirty()
Checks if any data within this Application Module has been modified but not yet committed. |
void |
postChanges()
Posts validated changes to database, so that subsequent SQL queries within this transaction will see the modifications. |
void |
reconnect(boolean force)
Reconnect the application module to the database, if necessary, using previously supplied database credentials. |
void |
rollback()
Restores the original row values to the current state of database, discarding any modifications. |
void |
setLockingMode(int mode)
Sets the preferred locking mode for this transaction. |
void |
validate()
Validates all modifications currently cached in this transaction. |
Field Detail |
public static final int LOCK_NONE
public static final int LOCK_PESSIMISTIC
public static final int LOCK_OPTIMISTIC
Method Detail |
public void connect(java.lang.String url)
The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.
Call isConnected()
to test for success.
url
- a database url of the form jdbc:subprotocol:subname.public void connect(java.lang.String url, java.util.Properties info)
The DriverManager
attempts to select an appropriate driver from
the set of registered JDBC drivers.
Call isConnected()
to test for success.
url
- a database url of the form jdbc:subprotocol:subname.info
- a list of arbitrary string tag/value pairs to be used as
connection arguments. Normally, at least "user" and
"password" properties should be included.public void connect(java.lang.String url, java.lang.String user, java.lang.String password)
The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.
Call isConnected()
to test for success.
url
- a database url of the form jdbc:subprotocol:subname.user
- the database user on whose behalf the connection is being made.password
- the user's password.public void reconnect(boolean force)
force
- force a reconnect, should usually be falsepublic void disconnect()
public boolean isConnected()
true
if connected.public void setLockingMode(int mode)
Changing the locking mode affects only subsequent locks.
mode
- one of the class' LOCK_
constants.public int getLockingMode()
If not set by setLockingMode()
,
the locking mode defaults to LOCK_PESSIMISTIC
.
public void validate()
public void postChanges()
If there are modifications in this transaction's cache that are
not validated, no attempt is made in this method to post those
to the database. Caller must call validate()
before calling
this method to post all modifications to the database,
before subsequent SQL queries can fetch those modifications.
public boolean isDirty()
true
if the local data and the database differ.public void commit()
public void rollback()
public int executeCommand(java.lang.String command)
command
- a valid SQL query.public java.lang.String dumpQueryResult(java.lang.String query, java.lang.String dumpClassName, java.lang.String[] data)
public java.lang.Object createRef(java.lang.String structName, byte[] data)
|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |