org.apache.cayenne.dba.oracle
Class OracleAdapter

java.lang.Object
  extended by org.apache.cayenne.dba.JdbcAdapter
      extended by 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.cayenne.adapter = org.apache.cayenne.dba.oracle.OracleAdapter
         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
         
        
 

Author:
Andrei Adamchik

Field Summary
protected static boolean initDone
           
static java.lang.String NEW_BLOB_FUNCTION
           
static java.lang.String NEW_CLOB_FUNCTION
           
static java.lang.String ORACLE_BLOB
           
static java.lang.String ORACLE_CLOB
           
static java.lang.String ORACLE_FLOAT
           
protected static int oracleCursorType
           
protected static java.lang.reflect.Method outputStreamFromBlobMethod
           
protected static boolean supportsOracleLOB
           
static java.lang.String TRIM_FUNCTION
           
protected static java.lang.reflect.Method writerFromClobMethod
           
 
Fields inherited from class org.apache.cayenne.dba.JdbcAdapter
extendedTypes, pkGenerator, supportsBatchUpdates, supportsFkConstraints, supportsGeneratedKeys, supportsUniqueConstraints, typesHandler
 
Constructor Summary
OracleAdapter()
           
 
Method Summary
 DbAttribute buildAttribute(java.lang.String name, java.lang.String typeName, int type, int size, int precision, 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  PkGenerator createPkGenerator()
          Creates and returns a primary key generator.
 java.lang.String dropTable(DbEntity ent)
          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.
static java.lang.reflect.Method getOutputStreamFromBlobMethod()
           
 QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler)
          Returns a trimming translator.
static java.lang.reflect.Method getWriterFromClobMethod()
           
protected static void initDriverInformation()
           
static boolean isSupportsOracleLOB()
           
protected  java.lang.Class queryTranslatorClass(Query q)
          Deprecated. Since 1.2 this is done via custom SQLActions.
 boolean shouldRunBatchQuery(DataNode node, java.sql.Connection con, BatchQuery query, OperationObserver delegate)
          Deprecated. Since 1.2
 
Methods inherited from class org.apache.cayenne.dba.JdbcAdapter
bindParameter, createDataNode, createFkConstraint, createTable, createTableAppendColumn, createTableAppendPKClause, createUniqueConstraint, externalTypesForJdbcType, findAdapterResource, getBatchTerminator, getExtendedTypes, getPkGenerator, getQueryTranslator, setPkGenerator, setSupportsBatchUpdates, setSupportsFkConstraints, setSupportsGeneratedKeys, setSupportsUniqueConstraints, supportsBatchUpdates, supportsFkConstraints, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORACLE_FLOAT

public static final java.lang.String ORACLE_FLOAT
See Also:
Constant Field Values

ORACLE_BLOB

public static final java.lang.String ORACLE_BLOB
See Also:
Constant Field Values

ORACLE_CLOB

public static final java.lang.String ORACLE_CLOB
See Also:
Constant Field Values

TRIM_FUNCTION

public static final java.lang.String TRIM_FUNCTION
See Also:
Constant Field Values

NEW_CLOB_FUNCTION

public static final java.lang.String NEW_CLOB_FUNCTION
See Also:
Constant Field Values

NEW_BLOB_FUNCTION

public static final java.lang.String NEW_BLOB_FUNCTION
See Also:
Constant Field Values

initDone

protected static boolean initDone

oracleCursorType

protected static int oracleCursorType

outputStreamFromBlobMethod

protected static java.lang.reflect.Method outputStreamFromBlobMethod

writerFromClobMethod

protected static java.lang.reflect.Method writerFromClobMethod

supportsOracleLOB

protected static boolean supportsOracleLOB
Constructor Detail

OracleAdapter

public OracleAdapter()
Method Detail

initDriverInformation

protected static void initDriverInformation()

getOutputStreamFromBlobMethod

public static java.lang.reflect.Method getOutputStreamFromBlobMethod()

isSupportsOracleLOB

public static boolean isSupportsOracleLOB()

getWriterFromClobMethod

public static java.lang.reflect.Method getWriterFromClobMethod()

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.


configureExtendedTypes

protected void configureExtendedTypes(ExtendedTypeMap map)
Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.

Overrides:
configureExtendedTypes in class JdbcAdapter

createPkGenerator

protected PkGenerator createPkGenerator()
Creates and returns a primary key generator. Overrides superclass implementation to return an instance of OraclePkGenerator.

Overrides:
createPkGenerator in class JdbcAdapter

dropTable

public java.lang.String dropTable(DbEntity ent)
Returns a query string to drop a table corresponding to ent DbEntity. Changes superclass behavior to drop all related foreign key constraints.

Specified by:
dropTable in interface DbAdapter
Overrides:
dropTable in class JdbcAdapter

buildAttribute

public DbAttribute buildAttribute(java.lang.String name,
                                  java.lang.String typeName,
                                  int type,
                                  int size,
                                  int precision,
                                  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)
precision - database column precision (ignored if less than zero)
allowNulls - database column nullable parameter

queryTranslatorClass

protected java.lang.Class queryTranslatorClass(Query q)
Deprecated. Since 1.2 this is done via custom SQLActions.

Returns Oracle-specific translator for object SELECT queries.

Overrides:
queryTranslatorClass in class JdbcAdapter

getQualifierTranslator

public QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler)
Returns a trimming translator.

Specified by:
getQualifierTranslator in interface DbAdapter
Overrides:
getQualifierTranslator in class JdbcAdapter

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

shouldRunBatchQuery

public boolean shouldRunBatchQuery(DataNode node,
                                   java.sql.Connection con,
                                   BatchQuery query,
                                   OperationObserver delegate)
                            throws java.sql.SQLException,
                                   java.lang.Exception
Deprecated. Since 1.2

Implements special LOB handling in batches.

Specified by:
shouldRunBatchQuery in interface DbAdapter
Overrides:
shouldRunBatchQuery in class JdbcAdapter
Throws:
java.sql.SQLException
java.lang.Exception


Copyright © 2001-2006 Apache.org All Rights Reserved.