Business Components

oracle.jbo
Interface Transaction

All Known Subinterfaces:
DBTransaction

public interface Transaction

Provides the base methods for defining database transactions.

Since:
JDeveloper 3.0

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

LOCK_NONE

public static final int LOCK_NONE
Indicates that the row locking mode is Manual.

LOCK_PESSIMISTIC

public static final int LOCK_PESSIMISTIC
Indicates that the row locking mode is Automatic and Pessimistic.

LOCK_OPTIMISTIC

public static final int LOCK_OPTIMISTIC
Indicates that the row locking mode is Automatic and Optimistic.
Method Detail

connect

public void connect(java.lang.String url)
Attempts to establish a connection to a database identified by a URL.

The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Call isConnected() to test for success.

Parameters:
url - a database url of the form jdbc:subprotocol:subname.

connect

public void connect(java.lang.String url,
                    java.util.Properties info)
Attempts to establish a connection to a database identified by a URL.

The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Call isConnected() to test for success.

Parameters:
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.

connect

public 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.

The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Call isConnected() to test for success.

Parameters:
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.

reconnect

public void reconnect(boolean force)
Reconnect the application module to the database, if necessary, using previously supplied database credentials. If the parameter is true, then a database disconnect and reconnect is performed, whatever the current connection state, if false, the connect is only performed if the connection has disappeared.
Parameters:
force - force a reconnect, should usually be false

disconnect

public void disconnect()
Terminates the database connection.

isConnected

public boolean isConnected()
Checks the database connection.
Returns:
true if connected.

setLockingMode

public void setLockingMode(int mode)
Sets the preferred locking mode for this transaction.

Changing the locking mode affects only subsequent locks.

Parameters:
mode - one of the class' LOCK_ constants.

getLockingMode

public int getLockingMode()
Gets the locking mode for this transaction.

If not set by setLockingMode(), the locking mode defaults to LOCK_PESSIMISTIC.

Returns:
the locking mode.

validate

public void validate()
Validates all modifications currently cached in this transaction.

postChanges

public void postChanges()
Posts validated changes to database, so that subsequent SQL queries within this transaction will see the modifications.

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.


isDirty

public boolean isDirty()
Checks if any data within this Application Module has been modified but not yet committed.
Returns:
true if the local data and the database differ.

commit

public void commit()
Updates the database with the modified data, so that it becomes visible to all users of the database.

rollback

public void rollback()
Restores the original row values to the current state of database, discarding any modifications.

executeCommand

public int executeCommand(java.lang.String command)
Executes a SQL command in the database under the current transaction.
Parameters:
command - a valid SQL query.

dumpQueryResult

public java.lang.String dumpQueryResult(java.lang.String query,
                                        java.lang.String dumpClassName,
                                        java.lang.String[] data)
Internal: Applications should not use this method.

createRef

public java.lang.Object createRef(java.lang.String structName,
                                  byte[] data)
Internal: Applications should not use this method.

Business Components