|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jbo.server.DBTransactionImpl
oracle.jbo.server.DBTransactionImpl2
public class DBTransactionImpl2
Implementation of DBTransaction
interface for representing both "connected"
and "not connected" state. In pre 9.0.3 versions the disconnected and connected state implementation was provided by
NullDBTransactionImpl and DBTransactionImpl respectivey.
DBTransactionImpl instance was created only when clients initiated the acquisition of a jdbc connection by calling
the one of Transaction.connect() or Transaction.connectToDataSource() methods.
oracle.jbo.server.DatabaseTransactionFactory
Field Summary | |
---|---|
static java.lang.Class |
CLASS_INSTANCE
|
Fields inherited from class oracle.jbo.server.DBTransactionImpl |
---|
MAX_CURSORS_UNINITIALIZED, mConnectionMetaData, mDMLOperationTimeOut, mLongRunningDMLOperationHandles, POST_ABORT_ON_FIRST_EXCEPTION, POST_ALL_NO_RESET_ON_EXCEPTION, POST_ALL_RESET_ON_EXCEPTION |
Fields inherited from interface oracle.jbo.server.DBTransaction |
---|
DEFAULT |
Fields inherited from interface oracle.jbo.Transaction |
---|
DML_OPERATION_TIMEOUT_WAIT_FOREVER, LOCK_NONE, LOCK_OPTIMISTIC, LOCK_OPTUPDATE, LOCK_PESSIMISTIC |
Constructor Summary | |
---|---|
DBTransactionImpl2()
|
Method Summary | |
---|---|
CallableStatement |
createCallableStatement(java.lang.String str,
int noRowsPrefetch)
Implementation of createCallableStatement method. |
PreparedStatement |
createPreparedStatement(java.lang.String str,
int noRowsPrefetch)
Implementation of createPreparedStatement method. |
Statement |
createStatement(int noRowsPrefetch)
Implementation of createStatement method. |
void |
rollback()
Discards all modifications made in this transaction. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Class CLASS_INSTANCE
Constructor Detail |
---|
public DBTransactionImpl2()
Method Detail |
---|
public Statement createStatement(int noRowsPrefetch)
createStatement
method.
createStatement
in interface DBTransaction
createStatement
in class DBTransactionImpl
noRowsPrefetch
- the number of rows to prefetch when executing this statement's query.
NotConnectedException
- if no jdbc connection was acquiredpublic CallableStatement createCallableStatement(java.lang.String str, int noRowsPrefetch)
createCallableStatement
method.
createCallableStatement
in class DBTransactionImpl
NotConnectedException
- if no jdbc connection was acquiredpublic PreparedStatement createPreparedStatement(java.lang.String str, int noRowsPrefetch)
createPreparedStatement
method.
createPreparedStatement
in interface DBTransaction
createPreparedStatement
in class DBTransactionImpl
str
- the PreparedStatement instance's SQL statement.noRowsPrefetch
- the number of rows to prefetch when executing this statement's query. If this parameter is set to
DBTransaction.DEFAULT, then the default value from the jdbc driver is used.
NotConnectedException
- if no jdbc connection was acquiredpublic void rollback()
DBTransactionImpl
appMod.getTransaction().rollback();When this method is invoked,
beforeRollback
events are posted to
the listeners, the changes are discarded,
afterRollback
events are posted, and
transient listeners are deleted from the transaction. For both events, non-transient listeners preceed transient
listeners.
In the following example, a method named updateAttr has been implemented to update a row of a View Object vo with the value newAttrVal. If updateAttr succeeds (returns true), the code commits the transaction; otherwise, it rolls the transaction back:
// Assume that appMod has been declared and initialized elsewhere. try { if (updateAttr(vo, newAttrVal)) { // Commit changes to the database, making // updated data available to other Application Modules. appMod.getTransaction().commit(); System.out.println("\n Transaction committed. \n"); } else { appMod.getTransaction().rollback(); System.out.println("\n Transaction rolled back. \n"); } } catch (Exception e) { e.printStackTrace(); }
Note, if your Application Module is an EJB session bean, a new transaction is started for you automatically after calling rollback. You do not have to explicitly start a new transaction.
rollback
in interface Transaction
rollback
in class DBTransactionImpl
DBTransaction
,
TransactionListener.afterRollback(TransactionEvent)
,
TransactionListener.beforeRollback(TransactionEvent)
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |