Class OracleAdapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.oracle.OracleAdapter
- All Implemented Interfaces:
DbAdapter
- Direct Known Subclasses:
Oracle8Adapter
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
FieldsModifier and TypeFieldDescriptionprotected static booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected static intprotected static booleanstatic final StringFields inherited from class JdbcAdapter
caseInsensitiveCollations, ejbqlTranslatorFactory, extendedTypes, logger, quotingStrategy, resourceLocator, supportsBatchUpdates, supportsGeneratedKeys, supportsUniqueConstraints, typesHandlerModifier and TypeFieldDescriptionprotected booleanprotected EJBQLTranslatorFactoryprotected ExtendedTypeMapprotected JdbcEventLoggerprotected QuotingStrategyprotected ResourceLocatorprotected booleanprotected booleanprotected booleanprotected TypesHandler -
Constructor Summary
ConstructorsConstructorDescriptionOracleAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidbindParameter(PreparedStatement statement, ParameterBinding binding) Binds an object value to PreparedStatement's parameter.buildAttribute(String name, String typeName, int type, int size, int scale, boolean allowNulls) Fixes some reverse engineering problems.protected voidInstalls appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.protected EJBQLTranslatorFactoryCreates and returns anEJBQLTranslatorFactoryused to generate visitors for EJBQL to SQL translations.dropTableStatements(DbEntity table) Returns a query string to drop a table corresponding toentDbEntity.Uses OracleActionBuilder to create the right action.static intReturns an Oracle JDBC extension type defined in oracle.jdbc.driver.OracleTypes.CURSOR.protected static voidstatic booleanbooleantypeSupportsScale(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, unwrapModifier and TypeMethodDescriptionReturns a SQL string that can be used to create a foreign key constraint for the relationship.protected QuotingStrategycreateTable(DbEntity entity) Returns a SQL string that can be used to create database table corresponding toentparameter.voidcreateTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) Appends SQL for column creation to CREATE TABLE buffer.protected voidcreateTableAppendPKClause(StringBuffer sqlBuffer, DbEntity entity) 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 JDBCtype.protected URLfindResource(String name) Locates and returns a named adapter resource.Returns default separator - a semicolon.Returns a translator factory for EJBQL to SQL translation.Returns a map of ExtendedTypes that is used to translate values between Java and JDBC layer.Returns primary key generator associated with this DbAdapter.Returns SQL identifier quoting strategy objectgetSelectTranslator(FluentSelect<?, ?> query, EntityResolver entityResolver) static StringgetType(DbAdapter adapter, DbAttribute column) protected voidinitExtendedTypes(List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry) voidsetEjbqlTranslatorFactory(EJBQLTranslatorFactory ejbqlTranslatorFactory) Sets a translator factory for EJBQL to SQL translation.voidsetPkGenerator(PkGenerator pkGenerator) Sets new primary key generator.voidsetSupportsBatchUpdates(boolean flag) voidsetSupportsGeneratedKeys(boolean flag) voidsetSupportsUniqueConstraints(boolean flag) static StringsizeAndPrecision(DbAdapter adapter, DbAttribute column) booleanReturnstrueif the target database supports batch updates.booleanReturns true.booleanReturns true if a target database supports key autogeneration.booleanReturns true.Returns the name of the table type (as returned byDatabaseMetaData.getTableTypes) for a simple user table.Returns the name of the table type (as returned byDatabaseMetaData.getTableTypes) for a view table.booleantypeSupportsLength(int type) Returns true if supplied type can have a length attribute as a part of column definitionunwrap()Simply returns this, as JdbcAdapter is not a wrapper.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DbAdapter
supportsGeneratedKeysForBatchInsertsModifier and TypeMethodDescriptiondefault booleanReturns true if a target database supports key autogeneration in a batch insert.
-
Field Details
-
ORACLE_FLOAT
- See Also:
-
ORACLE_BLOB
- See Also:
-
ORACLE_CLOB
- See Also:
-
ORACLE_NCLOB
- See Also:
-
TRIM_FUNCTION
- See Also:
-
NEW_CLOB_FUNCTION
- See Also:
-
NEW_BLOB_FUNCTION
- See Also:
-
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
- Specified by:
getSqlTreeProcessorin interfaceDbAdapter- Overrides:
getSqlTreeProcessorin classJdbcAdapter- Returns:
SQLTreeProcessorthat can adjust SQL tree to specific database flavour- Since:
- 4.2
-
createEJBQLTranslatorFactory
Description copied from class:JdbcAdapterCreates and returns anEJBQLTranslatorFactoryused to generate visitors for EJBQL to SQL translations. This method should be overriden by subclasses that need to customize EJBQL generation.- Overrides:
createEJBQLTranslatorFactoryin classJdbcAdapter- Since:
- 3.0
-
configureExtendedTypes
Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.- Overrides:
configureExtendedTypesin classJdbcAdapter
-
dropTableStatements
Returns a query string to drop a table corresponding toentDbEntity. Changes superclass behavior to drop all related foreign key constraints.- Specified by:
dropTableStatementsin interfaceDbAdapter- Overrides:
dropTableStatementsin classJdbcAdapter- Since:
- 3.0
-
bindParameter
public void bindParameter(PreparedStatement statement, ParameterBinding binding) throws SQLException, Exception Description copied from interface:DbAdapterBinds an object value to PreparedStatement's parameter.- Specified by:
bindParameterin interfaceDbAdapter- Overrides:
bindParameterin classJdbcAdapter- Throws:
SQLExceptionException
-
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:
buildAttributein interfaceDbAdapter- Overrides:
buildAttributein classJdbcAdapter- Parameters:
name- database column nametypeName- database specific type name, may be used as a hint to determine the right JDBC type.type- JDBC column typesize- 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
-
getSystemSchemas
- Specified by:
getSystemSchemasin interfaceDbAdapter- Overrides:
getSystemSchemasin classJdbcAdapter- Returns:
- list of system schemas
-
typeSupportsScale
public boolean typeSupportsScale(int type) Description copied from class:JdbcAdapterReturns true if supplied type can have a scale attribute as a part of column definition.- Specified by:
typeSupportsScalein interfaceDbAdapter- Overrides:
typeSupportsScalein classJdbcAdapter- Parameters:
type- sql type code- Returns:
trueif a given type supports scale- Since:
- 5.0
-