Class DerbyAdapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.derby.DerbyAdapter
- All Implemented Interfaces:
DbAdapter
DbAdapter implementation for the Derby RDBMS
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDerbyAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbind(PreparedStatement statement, Object value, int psPosition, int psType, int psScale, ExtendedType binder) Binds a raw value to a statement parameter.protected voidInstalls appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.protected EJBQLTranslatorCreates and returns anEJBQLTranslatorused to generate visitors for EJBQL to SQL translations.protected NativeColumnType[]Returns the database-native types supported by this adapter.Returns aDerbyPkGenerator.voidcreateTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) Appends SQL for column creation to CREATE TABLE buffer.Uses JdbcActionBuilder to create the right action.intpreferredBindingType(int jdbcType) Returns the JDBC type that this adapter prefers to bind for a given mapped JDBC type.booleanNot supported, see: DERBY-3609booleantypeSupportsLength(int type) Returns true if supplied type can have a length attribute as a part of column definitionbooleantypeSupportsScale(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, buildAttribute, createFkConstraint, createQuotingStrategy, createTable, createTableAppendPKClause, createUniqueConstraint, defaultCharColumnLength, dropTableStatements, externalTypesForJdbcType, getBatchTerminator, getEjbqlTranslator, getExtendedTypes, getProcedureTranslator, getQuotingStrategy, getQuotingStrategy, getSelectTranslator, getSQLLogger, getSystemCatalogs, getSystemSchemas, getType, initExtendedTypes, nativeColumnTypes, setEjbqlTranslator, setEjbqlTranslatorFactory, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, sizeAndScale, supportsBatchUpdates, supportsCatalogsOnReverseEngineering, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, unwrapMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DbAdapter
getEjbqlTranslatorFactory, preferredNativeColumnType
-
Constructor Details
-
DerbyAdapter
public DerbyAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry)
-
-
Method Details
-
createNativeTypes
Description copied from class:JdbcAdapterReturns the database-native types supported by this adapter.- Overrides:
createNativeTypesin classJdbcAdapter
-
supportsGeneratedKeysForBatchInserts
-
getAction
Description copied from class:JdbcAdapterUses JdbcActionBuilder to create the right action.- Specified by:
getActionin interfaceDbAdapter- Overrides:
getActionin classJdbcAdapter
-
configureExtendedTypes
Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.- Overrides:
configureExtendedTypesin classJdbcAdapter
-
createTableAppendColumn
Appends SQL for column creation to CREATE TABLE buffer. Only change for Derby is that " NULL" is not supported.- Specified by:
createTableAppendColumnin interfaceDbAdapter- Overrides:
createTableAppendColumnin classJdbcAdapter- Parameters:
sqlBuffer- theStringBufferto append the column type tocolumn- theDbAttributedefining the column to append type for- Since:
- 1.2
-
typeSupportsLength
public boolean typeSupportsLength(int type) Description copied from class:JdbcAdapterReturns true if supplied type can have a length attribute as a part of column definition- Specified by:
typeSupportsLengthin interfaceDbAdapter- Overrides:
typeSupportsLengthin classJdbcAdapter
-
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
-
createPkGenerator
Returns aDerbyPkGenerator.- Specified by:
createPkGeneratorin interfaceDbAdapter- Overrides:
createPkGeneratorin classJdbcAdapter
-
getSqlTreeProcessor
- Specified by:
getSqlTreeProcessorin interfaceDbAdapter- Overrides:
getSqlTreeProcessorin classJdbcAdapter- Returns:
SQLTreeProcessorthat can adjust SQL tree to specific database flavour- Since:
- 4.2
-
createEJBQLTranslator
Description copied from class:JdbcAdapterCreates and returns anEJBQLTranslatorused to generate visitors for EJBQL to SQL translations. This method should be overriden by subclasses that need to customize EJBQL generation.- Overrides:
createEJBQLTranslatorin classJdbcAdapter- Since:
- 3.1
-
bind
protected void bind(PreparedStatement statement, Object value, int psPosition, int psType, int psScale, ExtendedType binder) throws Exception Description copied from class:JdbcAdapterBinds a raw value to a statement parameter. This is the single extension point shared by bothbindParameteroverloads; adapters that need database-specific handling (e.g. of NULLs) should override this method rather than the public overloads.- Overrides:
bindin classJdbcAdapter- Throws:
Exception
-
preferredBindingType
public int preferredBindingType(int jdbcType) Description copied from interface:DbAdapterReturns the JDBC type that this adapter prefers to bind for a given mapped JDBC type. The default implementation is an identity function; adapters whose drivers require a different type (e.g. remapping theN*character types to their non-national counterparts) override this. The returned type is resolved into thePSParameterat binding creation time, so it matches the type actually sent to the PreparedStatement.- Since:
- 5.0
-