Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.jbo.server
Interface SQLBuilder

All Known Implementing Classes:
BaseSQLBuilderImpl, OLiteSQLBuilderImpl, PointBaseSQLBuilderImpl, SQL92SQLBuilderImpl, SQLiteSQLBuilderImpl

public interface SQLBuilder


Field Summary
static int BINDING_STYLE_JDBC
          Constant used to specify JDBC binding style while binding parameters to a statement object.
static int BINDING_STYLE_ORACLE
          Constant used to specify Oracle binding style while binding parameters to a statement object.
static int BINDING_STYLE_ORACLE_NAME
          Constant used to specify Oracle Named Parameter binding style while binding parameters to a statement object.
static int BINDING_STYLE_UNKNOWN
          Constant used to specify "Unknown" binding style while binding parameters to a statement object.
static int DML_DELETE
          Constant used to specify the DML mode to be DELETE.
static int DML_INSERT
          Constant used to specify the DML mode to be INSERT.
static int DML_UPDATE
          Constant used to specify the DML mode to be UPDATE.
 
Method Summary
 int bindDeleteStatement(EntityImpl entityContext, PreparedStatement stmt)
          Binds the values in the entity attribute storage with the DELETE statement.
 int bindInsertStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, java.util.Hashtable retrList, boolean batchMode)
          Binds the entity attribute storage with the parameters in the INSERT statement.
 int bindInsertStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, Map retrList, boolean batchMode)
          Binds the entity attribute storage with the parameters in the INSERT statement.
 void bindParametersForStmt(int bindingStyle, java.lang.Object[] params, PreparedStatement stmt)
          Bind parameter values for a SQL execution.
 int bindUpdateStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, java.util.Hashtable retrList, boolean batchMode)
          Binds the entity attribute storage with the parameters in the UPDATE statement.
 int bindUpdateStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, Map retrList, boolean batchMode)
          Binds the entity attribute storage with the parameters in the UPDATE statement.
 int bindWhereClause(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] keyCols, java.lang.Object rowid, int bindIndex)
          Bind the Primary key values for the designated Statement.
 void buildDefaultViewObjectFromClause(java.lang.StringBuffer fromClause, Vector eRefs, BaseViewCriteriaManagerImpl vcManager)
          This method is used to generate the "from" clause if the following conditions are met: The View Object definition does not have an expert mode query The View Object definition is set to generate "from" clause during runtime, either in metadata or by calling ViewDefImpl.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
 void buildDefaultViewObjectWhereClause(java.lang.StringBuffer whereClause, Vector eRefs)
          This method is used to generate the "where" clause if the following conditions are met: The View Object definition does not specify "where" clause The View Object definition is set to generate "where" clause during runtime, either in metadata or by calling ViewDefImpl.setWhereClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
 java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
          Build a DELETE SQL for the Entity Object.
 java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
          Build a INSERT SQL for the Entity Object skipping non-persistent values.
 void buildSelectList(java.lang.StringBuffer buffer, AttributeDefImpl[] attrs, java.lang.String sourceAlias, boolean forViewObject)
          Build a list of columns that could be used in a SELECT statement.
 void buildSelectString(DBTransactionImpl trans, java.lang.StringBuffer buffer, java.lang.String sourceName, java.lang.String sourceAlias, AttributeDefImpl[] attrs, boolean withIntoClause, int bindingStyle)
          Construct a SQL SELECT statement for the Entity into the designated Buffer.
 java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
          Build a UPDATE SQL for the Entity Object skipping non-persistent values.
 void buildWhereClause(EntityImpl entityContext, java.lang.StringBuffer buffer, AttributeDefImpl[] keyCols, java.lang.Object rowid)
          Creates a WHERE clause containing the Primary Key columns passed to the method.
 boolean compareFetchedValue(EntityImpl entity, AttributeDefImpl ad, java.lang.Object cacheValue, java.lang.Object fetchedValue)
          Compare the cacheValue with fetchedValue and if they are equal return true This API is used when comparing cached entity with a faulted in entity.
 java.lang.Object convertValueToStorageType(java.lang.Object value)
          This method is used to convert the Java type to a JDBC type so that it could be used to bind as a parameter for SQL execution.
 void doEntityDML(EntityImpl enrt, int operation, TransactionEvent e)
          Performs the appropriate SQL Data Manipulation Language (DML) operations on the database to reflect an update, delete or insert operation on an Entity Object.
 void doEntitySelect(EntityImpl e, boolean lock)
          Perform the appropriate SQL operations to execute a select operation on an Entity Object.
 void doEntitySelectForAltKey(EntityImpl e, int keyIndex, boolean lock)
           
 java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrs, int attrIndex, ResultSet rs, int rsIndex, DBTransactionImpl trans)
          Loads an array of objects from a result set.
 java.lang.Object doLoadFromResultSet(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, byte attrLoad, ResultSet rs, int index, DBTransactionImpl trans)
          Loads an object from a result set.
 java.lang.Object doLoadFromStatement(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, PreparedStatement ps, int index, Transaction trans)
          Loads an object from a result set.
 void doPreparedStatementDefineColumnType(PreparedStatement ps, int colnum, int sqltype)
          Performs the equivalent of defineColumnType() on a prepared statement.
 void doPreparedStatementDefines(PreparedStatement ps, AttributeDefImpl[] attrs)
          Defines the column types of the attributes based on the meta-data.
 void doRefreshSQL(EntityImpl entityContext, int operation, AttributeDefImpl[] columns, AttributeDefImpl[] keyCols)
          Refreshes the entity after an update on the database.
 void doStatementSetBindingStyle(Statement ps, int bindingStyle)
          Sets the binding style for the statement.
 void doStatementSetBindingStyleDefault(Statement ps)
          Sets the binding style to the default value of the database type.
 void doStatementSetRowPrefetch(Statement ps, int prefetchSize)
          Performs the equivalent of setRowPrefetch() on a statement.
 java.lang.Object generatePKBasedRef(EntityImpl entityContext)
          Generates a PK-Based REF for an Entity Object.
 java.lang.Object[] generateRefAndOID(EntityImpl e)
          Generates an object Ref and OID for an Entity Object.
 java.lang.Object generateRowID(EntityImpl e)
          Get the ROWID attribute.
 java.lang.String getClauseForDateLiteral(java.util.Date date)
          Creates a database platform specific clause for converting a date string literal to date datatype.
 java.lang.String getDbType()
          Returns a string uniquely identifying this type of SQLBuilder.
 java.lang.String getQueryHitCountSQL(RowSet rs)
          Returns a SQL statement to estimate the number of rows effected by the query using the rowset values.
 ViewCriteriaAdapter getViewCriteriaAdapter()
          Returns a ViewCriteriaAdapter for the SQLBuilder object.
 void processException(java.lang.Class callingClass, java.lang.String callingMethod, java.lang.String errorCode, java.lang.Exception sqlEx, java.lang.Object[] params)
          Handle SQL exceptions by wrapping into SQLStmtException or JboException.
 java.lang.Object registerDatabaseChangeListener(QueryCollection listener, Connection conn, Statement stmt)
          Register a Query Collection to listen to database data change events.
 void releaseSavepoint(Connection conn, java.lang.String id)
          Release SAVEPOINT if possible.
 void rollbackToSavepoint(Connection conn, java.lang.String id)
          Rollback to SAVEPOINT if possible.
 void setSavepoint(Connection conn, java.lang.String id)
          Issue a SAVEPOINT if possible.
 boolean shouldPutJoinConstraintInFromClause()
          Checks if the FROM clause allows view criteria.
 boolean supportsRowNumQuery()
          Checks if the database supports "rownum" identifier.
 void unregisterDatabaseChangeListener(java.lang.Object handle)
          UnRegister a previous registration to listen to database data change events.
 

Field Detail

DML_INSERT

static final int DML_INSERT
Constant used to specify the DML mode to be INSERT.

See Also:
doEntityDML(EntityImpl, int, TransactionEvent), Constant Field Values

DML_UPDATE

static final int DML_UPDATE
Constant used to specify the DML mode to be UPDATE.

See Also:
doEntityDML(EntityImpl, int, TransactionEvent), Constant Field Values

DML_DELETE

static final int DML_DELETE
Constant used to specify the DML mode to be DELETE.

See Also:
doEntityDML(EntityImpl, int, TransactionEvent), Constant Field Values

BINDING_STYLE_UNKNOWN

static final int BINDING_STYLE_UNKNOWN
Constant used to specify "Unknown" binding style while binding parameters to a statement object.

See Also:
doStatementSetBindingStyle(Statement, int), Constant Field Values

BINDING_STYLE_JDBC

static final int BINDING_STYLE_JDBC
Constant used to specify JDBC binding style while binding parameters to a statement object.

See Also:
doStatementSetBindingStyle(Statement, int), Constant Field Values

BINDING_STYLE_ORACLE

static final int BINDING_STYLE_ORACLE
Constant used to specify Oracle binding style while binding parameters to a statement object.

See Also:
doStatementSetBindingStyle(Statement, int), Constant Field Values

BINDING_STYLE_ORACLE_NAME

static final int BINDING_STYLE_ORACLE_NAME
Constant used to specify Oracle Named Parameter binding style while binding parameters to a statement object.

See Also:
doStatementSetBindingStyle(Statement, int), Constant Field Values
Method Detail

getDbType

java.lang.String getDbType()
Returns a string uniquely identifying this type of SQLBuilder. Examples are: "Oracle", "OLite", "SQL92".

Returns:
a String containing the Database type.

doEntityDML

void doEntityDML(EntityImpl enrt,
                 int operation,
                 TransactionEvent e)
Performs the appropriate SQL Data Manipulation Language (DML) operations on the database to reflect an update, delete or insert operation on an Entity Object.

Note: this method is subject to change.

Parameters:
enrt - the Entity Object.
operation - one of DML_INSERT, DML_UPDATE, or DML_DELETE.
e - the transaction.

buildInsertStatement

java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext,
                                            AttributeDefImpl[] cols,
                                            AttributeDefImpl[] retrCols,
                                            AttributeDefImpl[] retrKeyCols,
                                            boolean batchMode)
Build a INSERT SQL for the Entity Object skipping non-persistent values. If there are attributes in the Entity Object that need to be fetched after the INSERT succeeds, a CallableStatement is created to fetch those values.

Note: this method is subject to change.

Parameters:
entityContext - the entity object.
cols - the columns to be included in the INSERT statement.
retrCols - the Columns whose values need to be fetched after the INSERT succeeds.
retrKeyCols - the Columns that are used as Keys to fetch post-insert values.
batchMode - a flag to indicate if the INSERT statement needs to be optimized for batch mode.
Returns:
a StringBuffer object containing the INSERT statement.

buildUpdateStatement

java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext,
                                            AttributeDefImpl[] cols,
                                            AttributeDefImpl[] retrCols,
                                            AttributeDefImpl[] retrKeyCols,
                                            boolean batchMode)
Build a UPDATE SQL for the Entity Object skipping non-persistent values. If there are attributes in the Entity Object that need to be fetched after the UPDATE succeeds, a CallableStatement is created to fetch those values.

Note: this method is subject to change.

Parameters:
entityContext - the entity object.
cols - the columns to be included in the UPDATE statement.
retrCols - the Columns whose values need to be fetched after the UPDATE succeeds.
retrKeyCols - the Columns that are used as Keys to fetch post-update values.
batchMode - a flag to indicate if the UPDATE statement needs to be optimized for batch mode.
Returns:
a StringBuffer object containing the UPDATE statement.

buildDeleteStatement

java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
Build a DELETE SQL for the Entity Object. The row is deleted from the table using the values of the Primary keys defined in the Entity.

Note: this method is subject to change.

Parameters:
entityContext - the entity object.
Returns:
a StringBuffer object containing the UPDATE statement.

buildWhereClause

void buildWhereClause(EntityImpl entityContext,
                      java.lang.StringBuffer buffer,
                      AttributeDefImpl[] keyCols,
                      java.lang.Object rowid)
Creates a WHERE clause containing the Primary Key columns passed to the method.

Note: this method is subject to change.

Parameters:
entityContext - the entity object.
buffer - the StringBuffer object to which the WHERE clause is appended.
keyCols - the key attributes.
rowid - a rowid object if present.

bindUpdateStatement

int bindUpdateStatement(EntityImpl entityContext,
                        PreparedStatement stmt,
                        AttributeDefImpl[] cols,
                        AttributeDefImpl[] retrCols,
                        AttributeDefImpl[] retrKeyCols,
                        java.util.Hashtable retrList,
                        boolean batchMode)
                        throws SQLException
Binds the entity attribute storage with the parameters in the UPDATE statement.

Note: this method is subject to change.

Parameters:
entityContext - the entity object.
stmt - the statement handle executing the UPDATE statement.
cols - the columns involved in the UPDATE statement.
retrCols - the columns whose values need to be fetched after a successful insert.
retrKeyCols - the columns that act as a key to fetch the newly inserted values.
retrList - a map containing the references to store the fetched values.
batchMode - flag to indicate binding for batchMode.
Returns:
index of last bind variable set in this statement.
Throws:
SQLException

bindInsertStatement

int bindInsertStatement(EntityImpl entityContext,
                        PreparedStatement stmt,
                        AttributeDefImpl[] cols,
                        AttributeDefImpl[] retrCols,
                        AttributeDefImpl[] retrKeyCols,
                        java.util.Hashtable retrList,
                        boolean batchMode)
                        throws SQLException
Binds the entity attribute storage with the parameters in the INSERT statement.

Note: this method is subject to change.

Parameters:
entityContext - the entity object.
stmt - the statement handle executing the INSERT statement.
cols - the columns involved in the INSERT statement.
retrCols - the columns whose values need to be fetched after a successful insert.
retrKeyCols - the columns that act as a key to fetch the newly inserted values.
retrList - a map containing the references to store the fetched values.
batchMode - flag to indicate binding for batchMode.
Returns:
index of last bind variable set in this statement.
Throws:
SQLException

bindWhereClause

int bindWhereClause(EntityImpl entityContext,
                    PreparedStatement stmt,
                    AttributeDefImpl[] keyCols,
                    java.lang.Object rowid,
                    int bindIndex)
                    throws SQLException
Bind the Primary key values for the designated Statement. This routine will perform the bind operation for each of the Primary Key columns.

The presence or absence of the ROWID value determines whether the ROWID will be used for Row access.

Note: this method is subject to change.

Parameters:
entityContext - the Entity row.
stmt - the statement to bind the columns to.
rowid - the ROWID for the row if known.
bindIndex - the baseline idx for performing the bind operations.
Returns:
index of last bind variable set in this statement.
Throws:
SQLException

bindDeleteStatement

int bindDeleteStatement(EntityImpl entityContext,
                        PreparedStatement stmt)
                        throws SQLException
Binds the values in the entity attribute storage with the DELETE statement.

Note: this method is subject to change.

Parameters:
entityContext - the entity object.
stmt - the statement handle executing the DELETE statement.
Throws:
SQLException

bindParametersForStmt

void bindParametersForStmt(int bindingStyle,
                           java.lang.Object[] params,
                           PreparedStatement stmt)
                           throws SQLException
Bind parameter values for a SQL execution.

Note: this method is subject to change.

Parameters:
bindingStyle - specifies if Oracle, Oracle named parameter or JDBC binding style is used.
params - the list of parameters.
stmt - the statement to be executed.
Throws:
SQLException

buildSelectList

void buildSelectList(java.lang.StringBuffer buffer,
                     AttributeDefImpl[] attrs,
                     java.lang.String sourceAlias,
                     boolean forViewObject)
Build a list of columns that could be used in a SELECT statement.

Note: this method is subject to change.

Parameters:
buffer - the StringBuffer object to which the SELECT list is appended.
attrs - the list of attribute definitions to be considered for the SELECT list.
sourceAlias - the database object name that contains the attributes.

buildDefaultViewObjectFromClause

void buildDefaultViewObjectFromClause(java.lang.StringBuffer fromClause,
                                      Vector eRefs,
                                      BaseViewCriteriaManagerImpl vcManager)
This method is used to generate the "from" clause if the following conditions are met:
  • The View Object definition does not have an expert mode query
  • The View Object definition is set to generate "from" clause during runtime, either in metadata or by calling ViewDefImpl.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
  • Parameters:
    fromClause - A StringBuffer object that would be appended with the generated "from" clause.
    eRefs - The EntityReference objects that should be considered for generation of the "from" clause.
    vcManager - In ANSI generation, view criteria associated with the EntityAssociationReference are part of the FROM clause, and vcManager is used to build the where clause fragment. if NULL, view criteria won't be built

    shouldPutJoinConstraintInFromClause

    boolean shouldPutJoinConstraintInFromClause()
    Checks if the FROM clause allows view criteria. In ANSI SQL generation, join constraint view criteria are part of the ON clause.

    Returns:
    false for Oracle database and true otherwise.

    getViewCriteriaAdapter

    ViewCriteriaAdapter getViewCriteriaAdapter()
    Returns a ViewCriteriaAdapter for the SQLBuilder object. ViewCriteriaAdapter is used in creating WHERE clause based on a set of criteria for a ViewObject.

    Note: this method is subject to change.

    Returns:
    a ViewCriteriaAdapter instance.

    buildDefaultViewObjectWhereClause

    void buildDefaultViewObjectWhereClause(java.lang.StringBuffer whereClause,
                                           Vector eRefs)
    This method is used to generate the "where" clause if the following conditions are met:
  • The View Object definition does not specify "where" clause
  • The View Object definition is set to generate "where" clause during runtime, either in metadata or by calling ViewDefImpl.setWhereClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
  • Parameters:
    whereClause - A StringBuffer object that would be appended with the generated "where" clause.
    eRefs - The EntityReference objects that should be considered for generation of the "where" clause.

    getClauseForDateLiteral

    java.lang.String getClauseForDateLiteral(java.util.Date date)
    Creates a database platform specific clause for converting a date string literal to date datatype. May be used in date comparisions and other manipulations.

    Parameters:
    date - The date object that will be formatted and passed as a String
    Returns:
    A string representing the clause to be used while building the query statement.

    supportsRowNumQuery

    boolean supportsRowNumQuery()
    Checks if the database supports "rownum" identifier. Used for fetching rows in the specified range.

    Note: this method is subject to change.

    Returns:
    true for Oracle database and false otherwise.

    doStatementSetRowPrefetch

    void doStatementSetRowPrefetch(Statement ps,
                                   int prefetchSize)
                                   throws SQLException
    Performs the equivalent of setRowPrefetch() on a statement.

    Parameters:
    ps - the Statement object.
    prefetchSize - the fetch size.
    Throws:
    SQLException

    doStatementSetBindingStyle

    void doStatementSetBindingStyle(Statement ps,
                                    int bindingStyle)
    Sets the binding style for the statement.

    Parameters:
    ps - the Statement object.
    bindingStyle - valid values are BINDING_STYLE_JDBC, BINDING_STYLE_ORACLE, BINDING_STYLE_ORACLE_NAME.

    convertValueToStorageType

    java.lang.Object convertValueToStorageType(java.lang.Object value)
    This method is used to convert the Java type to a JDBC type so that it could be used to bind as a parameter for SQL execution.

    Note: this method is subject to change.

    Parameters:
    value - the object that needs to be converted.
    Returns:
    the JDBC type.

    doLoadFromResultSet

    java.lang.Object doLoadFromResultSet(java.lang.Object theTypeFactory,
                                         java.lang.Object theElemFactory,
                                         java.lang.Class theJavaType,
                                         byte attrLoad,
                                         ResultSet rs,
                                         int index,
                                         DBTransactionImpl trans)
    Loads an object from a result set.

    Note: this method is subject to change.

    Parameters:
    theTypeFactory - a custom factory to be used for constructing new instances.
    theElemFactory - currently unused.
    theJavaType - the Java datatype of the Object to be created.
    attrLoad - specifies if the load type is ATTR_LOAD_EACH, ATTR_LOAD_BULK or ATTR_LOAD_SKIP
    rs - the resultset.
    index - the index of the object to be loaded.
    trans - the reference to the transaction object used to fetch the resultset.
    Returns:
    a reference to the object loaded.
    Throws:
    DataCreationException

    doEntitySelect

    void doEntitySelect(EntityImpl e,
                        boolean lock)
    Perform the appropriate SQL operations to execute a select operation on an Entity Object.

    Note: this method is subject to change. Note: this method is subject to change.

    Parameters:
    e - the Entity Object.
    lock - if true, a "SELECT for UPDATE" statement is used.

    doEntitySelectForAltKey

    void doEntitySelectForAltKey(EntityImpl e,
                                 int keyIndex,
                                 boolean lock)

    generateRowID

    java.lang.Object generateRowID(EntityImpl e)
    Get the ROWID attribute.

    The ROWID attribute can be used to gain faster access to the underyling database data.

    Obtain the value for the ROWID attribute. If this entity doesn't support ROWID attributes, then return NULL. If, for some reason the value of the ROWID attribute isn't present, then return null.

    Note: this method is subject to change.

    Parameters:
    e - the entity object reference.
    Returns:
    an Object containing the ROWID or null if generate ROWID fails.

    generateRefAndOID

    java.lang.Object[] generateRefAndOID(EntityImpl e)
    Generates an object Ref and OID for an Entity Object. This is used for an object table.

    Note: this method is subject to change.

    Parameters:
    e - the entity object reference.

    compareFetchedValue

    boolean compareFetchedValue(EntityImpl entity,
                                AttributeDefImpl ad,
                                java.lang.Object cacheValue,
                                java.lang.Object fetchedValue)
    Compare the cacheValue with fetchedValue and if they are equal return true This API is used when comparing cached entity with a faulted in entity. Signature modified since 9.0.5.1 to allow for Entity context to be available during compare so that Applications could perform custom comparision logic based on either settings in the Entity or any other context available via the entity.

    Note: this method is subject to change.

    Parameters:
    entity - the entity object.
    ad - the attribute definition of the value being compared.
    cacheValue - the cached value.
    fetchedValue - the new fetched value.
    Returns:
    true if the values are same, false otherwise.

    doLoadBulkFromResultSet

    java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrs,
                                               int attrIndex,
                                               ResultSet rs,
                                               int rsIndex,
                                               DBTransactionImpl trans)
                                               throws DataCreationException
    Loads an array of objects from a result set.

    Note: this method is subject to change.

    Parameters:
    attrs - the list of attributes to be loaded.
    attrIndex - a particular attribute from the list - Currently unused.
    rs - the ResultSet containing the objects.
    rsIndex - the index of the object in the result set to be loaded.
    trans - the reference to the transaction object used to fetch the resultset.
    Returns:
    a reference to the array of objects loaded.
    Throws:
    DataCreationException

    registerDatabaseChangeListener

    java.lang.Object registerDatabaseChangeListener(QueryCollection listener,
                                                    Connection conn,
                                                    Statement stmt)
    Register a Query Collection to listen to database data change events. Currently this is available for Oracle database only.

    Parameters:
    listener - The Query Collection that holds the qualifying rows
    conn - Connection object
    stmt - The SQL Statement that needs to be monitored for the database to trigger notifications.
    Returns:
    An object that represents a registration handle that could be used to unregister.

    doPreparedStatementDefines

    void doPreparedStatementDefines(PreparedStatement ps,
                                    AttributeDefImpl[] attrs)
    Defines the column types of the attributes based on the meta-data.

    Note: this method is subject to change.

    Parameters:
    ps - the PreparedStatement object.
    attrs - the attribute definitions.

    processException

    void processException(java.lang.Class callingClass,
                          java.lang.String callingMethod,
                          java.lang.String errorCode,
                          java.lang.Exception sqlEx,
                          java.lang.Object[] params)
    Handle SQL exceptions by wrapping into SQLStmtException or JboException.

    Note: this method is subject to change.

    Parameters:
    errorCode - the SQL execution errorcode.
    sqlEx - the Exception object.
    params - the query parameters.

    unregisterDatabaseChangeListener

    void unregisterDatabaseChangeListener(java.lang.Object handle)
    UnRegister a previous registration to listen to database data change events.

    Parameters:
    Object - handle to the previous registration.

    generatePKBasedRef

    java.lang.Object generatePKBasedRef(EntityImpl entityContext)
    Generates a PK-Based REF for an Entity Object. This is used for an object table.

    Note: this method is subject to change.

    Parameters:
    entityContext - the entity object reference.

    rollbackToSavepoint

    void rollbackToSavepoint(Connection conn,
                             java.lang.String id)
                             throws SQLException
    Rollback to SAVEPOINT if possible.

    Parameters:
    conn - the Connection used to rollback the savepoint.
    id - the id for a savepoint
    Throws:
    SQLException

    setSavepoint

    void setSavepoint(Connection conn,
                      java.lang.String id)
                      throws SQLException
    Issue a SAVEPOINT if possible.

    Parameters:
    conn - the Connection used to create a savepoint.
    id - the id for a savepoint.
    Throws:
    SQLException

    releaseSavepoint

    void releaseSavepoint(Connection conn,
                          java.lang.String id)
                          throws SQLException
    Release SAVEPOINT if possible.

    Parameters:
    conn - the Connection used to release the savepoint.
    id - the id for a savepoint
    Throws:
    SQLException

    doRefreshSQL

    void doRefreshSQL(EntityImpl entityContext,
                      int operation,
                      AttributeDefImpl[] columns,
                      AttributeDefImpl[] keyCols)
    Refreshes the entity after an update on the database. The refresh depends entirely on, the attributes which were modified. If no UNIQUE/PRIMARY KEY attribute was set in the application, or they are modified in a database trigger then the refresh may not be able to find the required row. In this situation RowNotFoundException will be thrown. If there is good reason behind not setting any of the KEY attributes, then, in a custom SQLBuilder, this method should be overriden.

    Note: this method is subject to change.

    Parameters:
    entityContext - the Entity row.
    operation - SQL Operation
    columns - Columns to be selected.
    keyCols - Key columns to appear be to used to refresh, which appear in WHERE clause.

    buildSelectString

    void buildSelectString(DBTransactionImpl trans,
                           java.lang.StringBuffer buffer,
                           java.lang.String sourceName,
                           java.lang.String sourceAlias,
                           AttributeDefImpl[] attrs,
                           boolean withIntoClause,
                           int bindingStyle)
    Construct a SQL SELECT statement for the Entity into the designated Buffer. This routine will construct a SQL SELECT statement in the StringBuffer passed. It does this by appending the various components of the SELECT statement into the buffer area.

    Note: this method is subject to change.

    Parameters:
    trans - a reference to the transaction object.
    buffer - the StringBuffer object to which the SELECT statement is appended.
    sourceName - the database object from which the Columns are selected.
    sourceAlias - the database object alias.
    attrs - the attributes that are selected from the database object.
    withIntoClause - a boolean that indicates if an INTO Clause needs to be generated.
    bindingStyle - specifies if Oracle, Oracle named parameter or JDBC binding style is used in generating the parameter markers for the INTO clause.

    bindInsertStatement

    int bindInsertStatement(EntityImpl entityContext,
                            PreparedStatement stmt,
                            AttributeDefImpl[] cols,
                            AttributeDefImpl[] retrCols,
                            AttributeDefImpl[] retrKeyCols,
                            Map retrList,
                            boolean batchMode)
                            throws SQLException
    Binds the entity attribute storage with the parameters in the INSERT statement.

    Note: this method is subject to change.

    Parameters:
    entityContext - the entity object.
    stmt - the statement handle executing the INSERT statement.
    cols - the columns involved in the INSERT statement.
    retrCols - the columns whose values need to be fetched after a successful insert.
    retrKeyCols - the columns that act as a key to fetch the newly inserted values.
    retrList - a map containing the references to store the fetched values.
    batchMode - flag to indicate binding for batchMode.
    Returns:
    index of last bind variable set in this statement.
    Throws:
    SQLException

    bindUpdateStatement

    int bindUpdateStatement(EntityImpl entityContext,
                            PreparedStatement stmt,
                            AttributeDefImpl[] cols,
                            AttributeDefImpl[] retrCols,
                            AttributeDefImpl[] retrKeyCols,
                            Map retrList,
                            boolean batchMode)
                            throws SQLException
    Binds the entity attribute storage with the parameters in the UPDATE statement.

    Note: this method is subject to change.

    Parameters:
    entityContext - the entity object.
    stmt - the statement handle executing the UPDATE statement.
    cols - the columns involved in the UPDATE statement.
    retrCols - the columns whose values need to be fetched after a successful insert.
    retrKeyCols - the columns that act as a key to fetch the newly inserted values.
    retrList - a map containing the references to store the fetched values.
    batchMode - flag to indicate binding for batchMode.
    Returns:
    index of last bind variable set in this statement.
    Throws:
    SQLException

    doLoadFromStatement

    java.lang.Object doLoadFromStatement(java.lang.Object theTypeFactory,
                                         java.lang.Object theElemFactory,
                                         java.lang.Class theJavaType,
                                         PreparedStatement ps,
                                         int index,
                                         Transaction trans)
                                         throws DataCreationException
    Loads an object from a result set.

    Note: this method is subject to change.

    Parameters:
    theTypeFactory - a custom factory to be used for constructing new instances.
    theElemFactory - currently unused.
    theJavaType - the Java datatype of the Object to be created.
    ps - the statement reference used to retrieve the Object.
    index - the index of the object in the output list.
    trans - the reference to the transaction object used to fetch the resultset.
    Returns:
    a reference to the object loaded.
    Throws:
    DataCreationException

    doStatementSetBindingStyleDefault

    void doStatementSetBindingStyleDefault(Statement ps)
    Sets the binding style to the default value of the database type. For Oracle database it is set to BINDING_STYLE_ORACLE and for non-oracle databases it is set to BINDING_STYLE_JDBC.

    Note: this method is subject to change.

    Parameters:
    ps - the Statement object.

    getQueryHitCountSQL

    java.lang.String getQueryHitCountSQL(RowSet rs)
    Returns a SQL statement to estimate the number of rows effected by the query using the rowset values.

    Note: this method is subject to change.

    Parameters:
    rs - the RowSet object.
    Returns:
    the SQL statement as a String object.

    doPreparedStatementDefineColumnType

    void doPreparedStatementDefineColumnType(PreparedStatement ps,
                                             int colnum,
                                             int sqltype)
                                             throws SQLException
    Performs the equivalent of defineColumnType() on a prepared statement.

    Note: this method is subject to change.

    Parameters:
    ps - the PreparedStatement object.
    colnum - the column number.
    sqltype - the type of the column.
    Throws:
    SQLException

    Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
    11g Release 1 (11.1.1)

    E17503-02

    Copyright © 2011, Oracle and/or its affiliates. All rights reserved.