OracleAdapter (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.dba.oracle, class: OracleAdapter

# Class OracleAdapter

java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.oracle.OracleAdapter

All Implemented Interfaces:
  `DbAdapter`

Direct Known Subclasses:
  `Oracle8Adapter`

public class OracleAdapter extends JdbcAdapter
DbAdapter implementation for Oracle RDBMS . Sample connection settings to use with Oracle are shown below:

             test-oracle.jdbc.username = test
             test-oracle.jdbc.password = secret
             test-oracle.jdbc.url = jdbc:oracle:thin:@//192.168.0.20:1521/ora1
             test-oracle.jdbc.driver = oracle.jdbc.driver.OracleDriver

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static boolean`
  `initDone`
  `static final String`
  `NEW_BLOB_FUNCTION`
  `static final String`
  `NEW_CLOB_FUNCTION`
  `static final String`
  `ORACLE_BLOB`
  `static final String`
  `ORACLE_CLOB`
  `static final String`
  `ORACLE_FLOAT`
  `static final String`
  `ORACLE_NCLOB`
  `protected static int`
  `oracleCursorType`
  `protected static boolean`
  `supportsOracleLOB`
  `static final String`
  `TRIM_FUNCTION`

  ### Fields inherited from class JdbcAdapter

  `caseInsensitiveCollations, ejbqlTranslatorFactory, extendedTypes, logger, quotingStrategy, resourceLocator, supportsBatchUpdates, supportsGeneratedKeys, supportsUniqueConstraints, typesHandler`
  Modifier and Type
  Field
  Description
  `protected boolean`
  `caseInsensitiveCollations`
  `protected EJBQLTranslatorFactory`
  `ejbqlTranslatorFactory`
  `protected ExtendedTypeMap`
  `extendedTypes`
  `protected JdbcEventLogger`
  `logger`
  `protected QuotingStrategy`
  `quotingStrategy`
  `protected ResourceLocator`
  `resourceLocator`
  `protected boolean`
  `supportsBatchUpdates`
  `protected boolean`
  `supportsGeneratedKeys`
  `protected boolean`
  `supportsUniqueConstraints`
  `protected TypesHandler`
  `typesHandler`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OracleAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `bindParameter(PreparedStatement statement, ParameterBinding binding)`
  Binds an object value to PreparedStatement's parameter.
  `DbAttribute`
  `buildAttribute(String name, String typeName, int type, int size, int scale, boolean allowNulls)`
  Fixes some reverse engineering problems.
  `protected void`
  `configureExtendedTypes(ExtendedTypeMap map)`
  Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.
  `protected EJBQLTranslatorFactory`
  `createEJBQLTranslatorFactory()`
  Creates and returns an `EJBQLTranslatorFactory` used to generate visitors for EJBQL to SQL translations.
  `Collection<String>`
  `dropTableStatements(DbEntity table)`
  Returns a query string to drop a table corresponding to `ent` DbEntity.
  `SQLAction`
  `getAction(Query query, DataNode node)`
  Uses OracleActionBuilder to create the right action.
  `static int`
  `getOracleCursorType()`
  Returns an Oracle JDBC extension type defined in oracle.jdbc.driver.OracleTypes.CURSOR.
  `SQLTreeProcessor`
  `getSqlTreeProcessor()`
  `List<String>`
  `getSystemSchemas()`
  `protected static void`
  `initDriverInformation()`
  `static boolean`
  `isSupportsOracleLOB()`
  `boolean`
  `typeSupportsScale(int type)`
  Returns true if supplied type can have a scale attribute as a part of column definition.

  ### Methods inherited from class JdbcAdapter

  `createFkConstraint, createQuotingStrategy, createTable, createTableAppendColumn, createTableAppendPKClause, createUniqueConstraint, externalTypesForJdbcType, findResource, getBatchTerminator, getEjbqlTranslatorFactory, getExtendedTypes, getJdbcEventLogger, getPkGenerator, getQuotingStrategy, getSelectTranslator, getSystemCatalogs, getType, initExtendedTypes, setEjbqlTranslatorFactory, setPkGenerator, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, supportsBatchUpdates, supportsCatalogsOnReverseEngineering, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, typeSupportsLength, unwrap`
  Modifier and Type
  Method
  Description
  `String`
  `createFkConstraint(DbRelationship rel)`
  Returns a SQL string that can be used to create a foreign key constraint for the relationship.
  `protected QuotingStrategy`
  `createQuotingStrategy()`
  `String`
  `createTable(DbEntity entity)`
  Returns a SQL string that can be used to create database table corresponding to `ent` parameter.
  `void`
  `createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column)`
  Appends SQL for column creation to CREATE TABLE buffer.
  `protected void`
  `createTableAppendPKClause(StringBuffer sqlBuffer, DbEntity entity)`
  `String`
  `createUniqueConstraint(DbEntity source, Collection<DbAttribute> columns)`
  Returns a DDL string to create a unique constraint over a set of columns.
  `String[]`
  `externalTypesForJdbcType(int type)`
  Returns an array of RDBMS types that can be used with JDBC `type`.
  `protected URL`
  `findResource(String name)`
  Locates and returns a named adapter resource.
  `String`
  `getBatchTerminator()`
  Returns default separator - a semicolon.
  `EJBQLTranslatorFactory`
  `getEjbqlTranslatorFactory()`
  Returns a translator factory for EJBQL to SQL translation.
  `ExtendedTypeMap`
  `getExtendedTypes()`
  Returns a map of ExtendedTypes that is used to translate values between Java and JDBC layer.
  `JdbcEventLogger`
  `getJdbcEventLogger()`
  `PkGenerator`
  `getPkGenerator()`
  Returns primary key generator associated with this DbAdapter.
  `QuotingStrategy`
  `getQuotingStrategy()`
  Returns SQL identifier quoting strategy object
  `SelectTranslator`
  `getSelectTranslator(FluentSelect<?,?> query, EntityResolver entityResolver)`
  `List<String>`
  `getSystemCatalogs()`
  `static String`
  `getType(DbAdapter adapter, DbAttribute column)`
  `protected void`
  `initExtendedTypes(List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry)`
  `void`
  `setEjbqlTranslatorFactory(EJBQLTranslatorFactory ejbqlTranslatorFactory)`
  Sets a translator factory for EJBQL to SQL translation.
  `void`
  `setPkGenerator(PkGenerator pkGenerator)`
  Sets new primary key generator.
  `void`
  `setSupportsBatchUpdates(boolean flag)`
  `void`
  `setSupportsGeneratedKeys(boolean flag)`
  `void`
  `setSupportsUniqueConstraints(boolean flag)`
  `static String`
  `sizeAndPrecision(DbAdapter adapter, DbAttribute column)`
  `boolean`
  `supportsBatchUpdates()`
  Returns `true` if the target database supports batch updates.
  `boolean`
  `supportsCatalogsOnReverseEngineering()`
  Returns true.
  `boolean`
  `supportsGeneratedKeys()`
  Returns true if a target database supports key autogeneration.
  `boolean`
  `supportsUniqueConstraints()`
  Returns true.
  `String`
  `tableTypeForTable()`
  Returns the name of the table type (as returned by `DatabaseMetaData.getTableTypes`) for a simple user table.
  `String`
  `tableTypeForView()`
  Returns the name of the table type (as returned by `DatabaseMetaData.getTableTypes`) for a view table.
  `boolean`
  `typeSupportsLength(int type)`
  Returns true if supplied type can have a length attribute as a part of column definition
  `DbAdapter`
  `unwrap()`
  Simply returns this, as JdbcAdapter is not a wrapper.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface DbAdapter

  `supportsGeneratedKeysForBatchInserts`
  Modifier and Type
  Method
  Description
  `default boolean`
  `supportsGeneratedKeysForBatchInserts()`
  Returns true if a target database supports key autogeneration in a batch insert.

- ## Field Details

  - ### ORACLE_FLOAT

    public static final String ORACLE_FLOAT
    See Also:
      - Constant Field Values

  - ### ORACLE_BLOB

    public static final String ORACLE_BLOB
    See Also:
      - Constant Field Values

  - ### ORACLE_CLOB

    public static final String ORACLE_CLOB
    See Also:
      - Constant Field Values

  - ### ORACLE_NCLOB

    public static final String ORACLE_NCLOB
    See Also:
      - Constant Field Values

  - ### TRIM_FUNCTION

    public static final String TRIM_FUNCTION
    See Also:
      - Constant Field Values

  - ### NEW_CLOB_FUNCTION

    public static final String NEW_CLOB_FUNCTION
    See Also:
      - Constant Field Values

  - ### NEW_BLOB_FUNCTION

    public static final String NEW_BLOB_FUNCTION
    See Also:
      - Constant Field Values

  - ### initDone

    protected static boolean initDone

  - ### oracleCursorType

    protected static int oracleCursorType

  - ### supportsOracleLOB

    protected static boolean supportsOracleLOB

- ## Constructor Details

  - ### OracleAdapter

    public OracleAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry)

- ## Method Details

  - ### initDriverInformation

    protected static void initDriverInformation()

  - ### isSupportsOracleLOB

    public static boolean isSupportsOracleLOB()

  - ### getOracleCursorType

    public static int getOracleCursorType()
    Returns an Oracle JDBC extension type defined in oracle.jdbc.driver.OracleTypes.CURSOR. This value is determined from Oracle driver classes via reflection in runtime, so that Cayenne code has no compile dependency on the driver. This means that calling this method when the driver is not available will result in an exception.

  - ### getSqlTreeProcessor

    public SQLTreeProcessor getSqlTreeProcessor()
    Specified by:
      `getSqlTreeProcessor` in interface `DbAdapter`
    Overrides:
      `getSqlTreeProcessor` in class `JdbcAdapter`
    Returns:
      `SQLTreeProcessor` that can adjust SQL tree to specific database flavour
    Since:
      4.2

  - ### createEJBQLTranslatorFactory

    protected EJBQLTranslatorFactory createEJBQLTranslatorFactory()
    Description copied from class: `JdbcAdapter`
    Creates and returns an `EJBQLTranslatorFactory` used to generate visitors for EJBQL to SQL translations. This method should be overriden by subclasses that need to customize EJBQL generation.
    Overrides:
      `createEJBQLTranslatorFactory` in class `JdbcAdapter`
    Since:
      3.0

  - ### configureExtendedTypes

    protected void configureExtendedTypes(ExtendedTypeMap map)
    Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.
    Overrides:
      `configureExtendedTypes` in class `JdbcAdapter`

  - ### dropTableStatements

    public Collection<String> dropTableStatements(DbEntity table)
    Returns a query string to drop a table corresponding to `ent` DbEntity. Changes superclass behavior to drop all related foreign key constraints.
    Specified by:
      `dropTableStatements` in interface `DbAdapter`
    Overrides:
      `dropTableStatements` in class `JdbcAdapter`
    Since:
      3.0

  - ### bindParameter

    public void bindParameter(PreparedStatement statement, ParameterBinding binding) throws SQLException, Exception
    Description copied from interface: `DbAdapter`
    Binds an object value to PreparedStatement's parameter.
    Specified by:
      `bindParameter` in interface `DbAdapter`
    Overrides:
      `bindParameter` in class `JdbcAdapter`
    Throws:
      `SQLException`
      `Exception`

  - ### buildAttribute

    public DbAttribute buildAttribute(String name, String typeName, int type, int size, int scale, boolean allowNulls)
    Fixes some reverse engineering problems. Namely if a columns is created as DECIMAL and has non-positive precision it is converted to INTEGER.
    Specified by:
      `buildAttribute` in interface `DbAdapter`
    Overrides:
      `buildAttribute` in class `JdbcAdapter`
    Parameters:
      `name` - database column name
      `typeName` - database specific type name, may be used as a hint to determine the right JDBC type.
      `type` - JDBC column type
      `size` - database column size (ignored if less than zero)
      `scale` - database column scale, i.e. the number of decimal digits (ignored if less than zero)
      `allowNulls` - database column nullable parameter

  - ### getAction

    public SQLAction getAction(Query query, DataNode node)
    Uses OracleActionBuilder to create the right action.
    Specified by:
      `getAction` in interface `DbAdapter`
    Overrides:
      `getAction` in class `JdbcAdapter`
    Since:
      1.2

  - ### getSystemSchemas

    public List<String> getSystemSchemas()
    Specified by:
      `getSystemSchemas` in interface `DbAdapter`
    Overrides:
      `getSystemSchemas` in class `JdbcAdapter`
    Returns:
      list of system schemas

  - ### typeSupportsScale

    public boolean typeSupportsScale(int type)
    Description copied from class: `JdbcAdapter`
    Returns true if supplied type can have a scale attribute as a part of column definition.
    Specified by:
      `typeSupportsScale` in interface `DbAdapter`
    Overrides:
      `typeSupportsScale` in class `JdbcAdapter`
    Parameters:
      `type` - sql type code
    Returns:
      `true` if a given type supports scale
    Since:
      5.0