# Class OracleAdapter

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

All Implemented Interfaces:
  `DbAdapter`

public class OracleAdapter extends JdbcAdapter
DbAdapter implementation for Oracle RDBMS

- ## 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, defaultCharColumnLength, ejbqlTranslator, extendedTypes, logger, nativeColumnTypes, quotingStrategy, supportsBatchUpdates, supportsGeneratedKeys, supportsUniqueConstraints`

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `bind(PreparedStatement statement, Object value, int psPosition, int psType, int psScale, ExtendedType binder)`
  Binds a raw value to a statement parameter.
  `DbAttribute`
  `buildAttribute(String name, String typeName, int type, int maxLength, 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 EJBQLTranslator`
  `createEJBQLTranslator()`
  Creates and returns an `EJBQLTranslator` used to generate visitors for EJBQL to SQL translations.
  `protected NativeColumnType[]`
  `createNativeTypes()`
  Returns the database-native types supported by this adapter.
  `PkGenerator`
  `createPkGenerator()`
  Returns a `OraclePkGenerator`.
  `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

  `bindParameter, bindParameter, createFkConstraint, createQuotingStrategy, createTable, createTableAppendColumn, createTableAppendPKClause, createUniqueConstraint, defaultCharColumnLength, externalTypesForJdbcType, getBatchTerminator, getEjbqlTranslator, getExtendedTypes, getProcedureTranslator, getQuotingStrategy, getQuotingStrategy, getSelectTranslator, getSQLLogger, getSystemCatalogs, getType, initExtendedTypes, nativeColumnTypes, setEjbqlTranslator, setEjbqlTranslatorFactory, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, sizeAndScale, supportsBatchUpdates, supportsCatalogsOnReverseEngineering, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, typeSupportsLength, unwrap`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface DbAdapter

  `getEjbqlTranslatorFactory, preferredBindingType, preferredNativeColumnType, supportsGeneratedKeysForBatchInserts`

- ## 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, 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.

  - ### createNativeTypes

    protected NativeColumnType[] createNativeTypes()
    Description copied from class: `JdbcAdapter`
    Returns the database-native types supported by this adapter.
    Overrides:
      `createNativeTypes` in class `JdbcAdapter`

  - ### createPkGenerator

    public PkGenerator createPkGenerator()
    Returns a `OraclePkGenerator`.
    Specified by:
      `createPkGenerator` in interface `DbAdapter`
    Overrides:
      `createPkGenerator` in class `JdbcAdapter`

  - ### 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

  - ### createEJBQLTranslator

    protected EJBQLTranslator createEJBQLTranslator()
    Description copied from class: `JdbcAdapter`
    Creates and returns an `EJBQLTranslator` used to generate visitors for EJBQL to SQL translations. This method should be overriden by subclasses that need to customize EJBQL generation.
    Overrides:
      `createEJBQLTranslator` 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

  - ### bind

    protected void bind(PreparedStatement statement, Object value, int psPosition, int psType, int psScale, ExtendedType binder) throws Exception
    Description copied from class: `JdbcAdapter`
    Binds a raw value to a statement parameter. This is the single extension point shared by both `bindParameter` overloads; adapters that need database-specific handling (e.g. of NULLs) should override this method rather than the public overloads.
    Overrides:
      `bind` in class `JdbcAdapter`
    Throws:
      `Exception`

  - ### buildAttribute

    public DbAttribute buildAttribute(String name, String typeName, int type, int maxLength, 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
      `maxLength` - 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