|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.jbo.server.DBTransactionImpl | +--oracle.jbo.server.DBTransactionImpl2
Fields inherited from class oracle.jbo.server.DBTransactionImpl |
MAX_CURSORS_UNINITIALIZED, mConnectionCredentials, mInternalCredentials,
mSQLBuilder, mTxnListeners |
Fields inherited from interface oracle.jbo.server.DBTransaction |
DEFAULT |
Fields inherited from interface oracle.jbo.Transaction |
LOCK_NONE, LOCK_OPTIMISTIC, LOCK_PESSIMISTIC |
Constructor Summary |
DBTransactionImpl2()
|
Method Summary |
Type | Method |
---|---|
void |
connect(java.sql.Connection sqlConnection)
Uses this JDBC Connection object to connect to the database for all operations via this transaction. |
void |
connect(java.lang.String url)
Uses this JDBC Connection object to connect to the database for all operations via this transaction. |
void |
connect(java.lang.String url,
java.util.Properties info)
Internal: Applications should not use this method. |
void |
connect(java.lang.String url,
java.lang.String user,
java.lang.String password)
Internal: Applications should not use this method. |
void |
connectToDataSource(javax.sql.DataSource ds,
boolean isJTAbased)
|
void |
connectToDataSource(javax.sql.DataSource ds,
java.lang.String user,
java.lang.String passwd,
boolean isJTAbased)
|
void |
connectToDataSource(java.util.Hashtable env,
java.lang.String dsName,
boolean isJTABased)
Looks up a datasource from a jndi tree and acquires the jdbc connection from the looked up datasource using the javax.sql.Datasource.getConnection(String user, String passwd) method. |
void |
connectToDataSource(java.util.Hashtable env,
java.lang.String dsName,
java.lang.String user,
java.lang.String passwd,
boolean isJTABased)
Looks up a datasource from a jndi tree and acquires the jdbc connection from the looked up datasource using the javax.sql.Datasource.getConnection(String user, String passwd) method. |
void |
connectToDataSource(java.lang.String nsUrl,
java.lang.String nsUser,
java.lang.String nsPasswd,
java.lang.String dsUrl)
Looks up a datasource from Oracle 8i namespace using the jdbc_access protocol and acquires the default jdbc connection from the looked up datasource using the javax.sql.Datasource.getConnection() method. |
void |
connectToDataSource(java.lang.String nsUrl,
java.lang.String nsUser,
java.lang.String nsPasswd,
java.lang.String dsUrl,
java.lang.String user,
java.lang.String passwd)
Looks up a datasource from Oracle 8i namespace using the jdbc_access protocol and acquires the jdbc connection from the looked up datasource using the javax.sql.Datasource.getConnection(String user, String password) method. |
java.sql.CallableStatement |
createCallableStatement(java.lang.String str,
int noRowsPrefetch)
Creates a JDBC CallableStatement instance. |
EntityImpl |
createEntityInstance(EntityDefImpl entityDef,
AttributeList al)
Creates an EntityImpl object based on the given defintion, in the context
of the root Application Module. |
EntityImpl |
createEntityInstance(java.lang.String entityDefName,
AttributeList al)
Creates an EntityImpl object based on the given defintion, in the context
of the root Application Module. |
java.sql.PreparedStatement |
createPreparedStatement(java.lang.String str,
int noRowsPrefetch)
Creates a JDBC PreparedStatement instance. |
java.lang.Object |
createRef(java.lang.String structName,
byte[] data)
Internal: Applications should not use this method. |
java.sql.Statement |
createStatement(int noRowsPrefetch)
Creates a JDBC Statement instance. |
ViewObject |
createViewObjectFromQueryClauses(java.lang.String eoName,
java.lang.String selectClause,
java.lang.String fromClause,
java.lang.String whereClause,
java.lang.String orderByClause)
Creates an updatable query definition. |
ViewObject |
createViewObjectFromQueryStmt(java.lang.String sqlStatement)
Creates an anonymous query definition from an SQL statement. |
void |
disconnect(boolean retainState)
Closes the JDBC connection object. |
EntityImpl |
findByPrimaryKey(EntityDefImpl entityDef,
Key key)
Finds an Entity Object in this transaction given an EntityDef object and a Primary Key. |
EntityImpl |
findByPrimaryKey(java.lang.String entityDefName,
Key key)
Finds an Entity Object in this transaction given the String name of the EntityDef and a Primary Key. |
void |
reconnect()
Reconnect the ApplicationModule to the database, using previously supplied database credentials. |
void |
reconnect(boolean force)
Reconnect the Application Module to the database, if necessary, using previously supplied database credentials. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DBTransactionImpl2()
Method Detail |
public void connect(java.sql.Connection sqlConnection)
DBTransactionImpl
connect
in class DBTransactionImpl
public void connect(java.lang.String url)
DBTransactionImpl
Use the connect
method on the Transaction
interface instead.
connect
in class DBTransactionImpl
oracle.jbo.Transaction
url
- a database url of the form jdbc:subprotocol:subname.public void connect(java.lang.String url, java.util.Properties info)
Use the connect
method on the Transaction
interface instead.
connect
in class DBTransactionImpl
oracle.jbo.Transaction
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)
Use the connect
method on the Transaction
interface instead.
connect
in class DBTransactionImpl
oracle.jbo.Transaction
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 connectToDataSource(java.lang.String nsUrl, java.lang.String nsUser, java.lang.String nsPasswd, java.lang.String dsUrl)
Transaction
connectToDataSource
in class DBTransactionImpl
oracle.jbo.Transaction
nsUrl
- Url to the jndi namespace where the datasource is boundnsUser
- User name that is used to access the namespace.nsPasswd
- nsUsers' passwddatasourceName
- Datasource
name as bound in the namespace.
Name can be the fully qaultified url such as
jdbc_access://test/ds/db1 otherwise the
the url prefix jdbc_acess:// is prepended to the
datasource name for lookup.public void connectToDataSource(java.lang.String nsUrl, java.lang.String nsUser, java.lang.String nsPasswd, java.lang.String dsUrl, java.lang.String user, java.lang.String passwd)
Transaction
connectToDataSource
in class
DBTransactionImpl
oracle.jbo.Transaction
nsUrl
- Url to the jndi namespace where the datasource is boundnsUser
- User name that is used to access the namespace.nsPasswd
- nsUsers' passwddatasourceName
- Datasource
name as bound in the namespace.
Name can be the fully qaultified url such as
jdbc_access://test/ds/db1 otherwise the
the url prefix jdbc_acess:// is prepended to the
datasource name for lookup.user
- Username for which the connection is acquired from the datasourcepassword
- User's password.public void connectToDataSource(javax.sql.DataSource ds, boolean isJTAbased)
connectToDataSource
in class DBTransactionImpl
public void connectToDataSource(javax.sql.DataSource ds, java.lang.String user, java.lang.String passwd, boolean isJTAbased)
connectToDataSource
in class DBTransactionImpl
public void connectToDataSource(java.util.Hashtable env, java.lang.String dsName, java.lang.String user, java.lang.String passwd, boolean isJTABased)
Transaction
connectToDataSource
in class DBTransactionImpl
oracle.jbo.Transaction
initialContextEnv
- Envirionment used the create initial context.
May be null.datasourceName
- Datasource name as bound in the namespace.user
- Username for which the connection is acquired from the datasourcepassword
- User's password.isXABased
- True if datasource is XADataSource implementation.
If true, the tranasction is assumed to be controlled
by an external transaction manager.public void connectToDataSource(java.util.Hashtable env, java.lang.String dsName, boolean isJTABased)
Transaction
connectToDataSource
in class DBTransactionImpl
oracle.jbo.Transaction
initialContextEnv
- Envirionment used the create initial context.
May be null.datasourceName
- Datasource name as bound in the namespace.isXABased
- True if datasource is XADataSource implementation.
If true, the tranasction is assumed to be controlled
by an external transaction manager.public void disconnect(boolean retainState)
DBTransactionImpl
If disconnect is invoked with retainState equal to true then this
transaction's JDBC connection will be closed but, the root application
module will continue to reference this transaction and its state. The
transaction state may include unposted database changes and cached result
sets. In the middle tier, reconnect
on the DBTransaction
interface
may be invoked to re-establish a JDBC connection for this transaction. If
connection pooling is enabled for this middle tier instance this
connection may represent a recycled connection.
The developer should take measures to ensure that the following requirements are met before attempting to disconnect a JDBC connection and retain application module state. All of these validations are not currently performed by the disconnection implementation because of performance considerations:
All non-forward only view objects should have fetched in all data
If pessimistic locking is enabled, all pending changes should be commited/rolled back.
All changes that have been posted to the database should be commited/rolled back>/p>
disconnect
in class DBTransactionImpl
public void reconnect()
DBTransactionImpl
DBTransactionImpl.disconnect(boolean)
with
the retainState parameter equal to true or, if a previous isConnected()
request had discovered a stale JDBC connection. If it is invoked
otherwise the method will do nothing.reconnect
in class DBTransactionImpl
oracle.jbo.server.DBTransactionImpl
DBTransactionImpl.disconnect(boolean)
public void reconnect(boolean force)
reconnect
in class DBTransactionImpl
force
- force a reconnect, should usually be false.public java.sql.Statement createStatement(int noRowsPrefetch)
DBTransaction
Applications may use this method to create a JDBC statement object to execute application specific SQL statements directly, so that the modifications are committed to the database in a single transaction through this object.
createStatement
in class DBTransactionImpl
oracle.jbo.server.DBTransaction
noRowsPrefetch
- the number of rows to prefetch when executing
this statement's query.public java.sql.CallableStatement createCallableStatement(java.lang.String str, int noRowsPrefetch)
DBTransaction
Applications may use this method to create a JDBC callable statement object to execute application-specific SQL statements directly, so that the modifications are committed to the database in a single transaction through this object.
createCallableStatement
in class DBTransactionImpl
oracle.jbo.server.DBTransaction
str
- the CallableStatement 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.public java.sql.PreparedStatement createPreparedStatement(java.lang.String str, int noRowsPrefetch)
DBTransaction
Applications may use this method to create a JDBC callable statement object to execute application specific SQL statements directly, so that the modifications are committed to the database in a single transaction through this object.
createPreparedStatement
in class DBTransactionImpl
oracle.jbo.server.DBTransaction
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.public EntityImpl createEntityInstance(EntityDefImpl entityDef, AttributeList al)
DBTransactionImpl
EntityImpl
object based on the given defintion, in the context
of the root Application Module. Passes the
attribute list, al, to the
create
method on the EntityImpl.createEntityInstance
in class DBTransactionImpl
oracle.jbo.server.DBTransactionImpl
entityDef
- the EntityDef defintion to use to create the EntityImpl.al
- attribute list to pass to the create() method on the
EntityImpl.public EntityImpl createEntityInstance(java.lang.String entityDefName, AttributeList al)
DBTransactionImpl
EntityImpl
object based on the given defintion, in the context
of the root Application Module. Passes the
attribute list, al, to the
create
method on the EntityImpl.createEntityInstance
in class DBTransactionImpl
oracle.jbo.server.DBTransactionImpl
entityDefName
- the String name of entity defintion to use to create the EntityImpl.al
- attribute list to pass to the create method on the
EntityImpl.public EntityImpl findByPrimaryKey(EntityDefImpl entityDef, Key key)
DBTransactionImpl
Given the EntityDef object and the table's primary key, this method returns the associated Entity Object. If the Entity has not already been brought into the cache by any of the View Objects, this method will cause the Entity to be fetched from the database. This method returns null if the Entity Object is not found.
For example, use this method to create a set of Entity Objects based on a relational schema without the need to create any Application Modules or View Objects. To do this, use findByPrimaryKey to locate a specific object and then traverse association accessors to get to all the other objects.
findByPrimaryKey
in class DBTransactionImpl
oracle.jbo.server.DBTransactionImpl
entityDef
- the Entity Def object to to be used to find the instance.key
- the Primary Key.public EntityImpl findByPrimaryKey(java.lang.String entityDefName, Key key)
DBTransactionImpl
Given the String name of the EntityDef and the table's primary key, this method returns the associated Entity Object. If the Entity has not already been brought into the cache by any of the View Objects, this method will cause the Entity to be fetched from the database.
This method returns null if the Entity Object is not found.
For example, use this method to create a set of Entity Objects based on a relational schema without the need to create any Application Modules or View Objects. To do this, use findByPrimaryKey to locate a specific object and then traverse association accessors to get to all the other objects.
findByPrimaryKey
in class DBTransactionImpl
oracle.jbo.server.DBTransactionImpl
entityDefName
- the name of the defintion to to be used to find the instance.key
- the Primary Key.public ViewObject createViewObjectFromQueryClauses(java.lang.String eoName, java.lang.String selectClause, java.lang.String fromClause, java.lang.String whereClause, java.lang.String orderByClause)
DBTransactionImpl
Creates an anonymous query definition from an Entity Object and parts of a SQL statement. For more information on anonymous View Objects, see Using Anonymous View Objects
Calling method should also call remove() for the View Object to be properly garbage-collected.
createViewObjectFromQueryClauses
in class DBTransactionImpl
oracle.jbo.server.DBTransactionImpl
eoName
- the name of a EntityObject
beaninfo class.selectClause
- an SQL statement SELECT clause.fromClause
- an SQL statement FROM clause.whereClause
- an
SQL statement WHERE clause.orderbyClause
- an SQL statement ORDERBY clause.public ViewObject createViewObjectFromQueryStmt(java.lang.String sqlStatement)
DBTransactionImpl
Calling method should also call remove() for the View Object to be properly garbage-collected.
The following example creates a View Object that queries for the system date:
ViewObject vo = tx.createViewObjectFromQueryStmt("select sysdate from dual"); Row row = vo.first(); Date now = (Date) row.getAttribute(0); System.out.println("The date/time is now: "+now); oracle.sql.DATE nextMonth = now.addMonths(1); System.out.println("The date/time is now: "+nextMonth);
createViewObjectFromQueryStmt
in class DBTransactionImpl
oracle.jbo.server.DBTransactionImpl
sqlStatement
- a SQL statement.public java.lang.Object createRef(java.lang.String structName, byte[] data)
DBTransactionImpl
createRef
in class DBTransactionImpl
|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |