Class HSQLDBAdapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.hsqldb.HSQLDBAdapter
- All Implemented Interfaces:
DbAdapter
- Direct Known Subclasses:
HSQLDBNoSchemaAdapter
DbAdapter implementation for the
HSQLDB RDBMS . Sample connection settings to use with HSQLDB are shown
below:
test-hsqldb.jdbc.username = test
test-hsqldb.jdbc.password = secret
test-hsqldb.jdbc.url = jdbc:hsqldb:hsql://serverhostname
test-hsqldb.jdbc.driver = org.hsqldb.jdbcDriver
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionHSQLDBAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalled fromJdbcAdapter.initExtendedTypes(List, List, List, ValueObjectTypeRegistry)to load adapter-specific types into the ExtendedTypeMap right after the default types are loaded, but before the DI overrides are.protected EJBQLTranslatorFactoryCreates and returns anEJBQLTranslatorFactoryused to generate visitors for EJBQL to SQL translations.Adds an ADD CONSTRAINT clause to a relationship constraint.createTable(DbEntity ent) Uses "CREATE CACHED TABLE" instead of "CREATE TABLE".voidcreateTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) Appends SQL for column creation to CREATE TABLE buffer.createUniqueConstraint(DbEntity source, Collection<DbAttribute> columns) Returns a DDL string to create a unique constraint over a set of columns.Uses special action builder to create the right action.protected StringgetSchemaName(DbEntity entity) Returns DbEntity schema name for 1.8 and on.protected StringgetTableName(DbEntity entity) Generate fully-qualified name for 1.8 and on.Methods inherited from class JdbcAdapter
bindParameter, buildAttribute, createQuotingStrategy, createTableAppendPKClause, dropTableStatements, externalTypesForJdbcType, findResource, getBatchTerminator, getEjbqlTranslatorFactory, getExtendedTypes, getJdbcEventLogger, getPkGenerator, getQuotingStrategy, getSelectTranslator, getSystemCatalogs, getSystemSchemas, getType, initExtendedTypes, setEjbqlTranslatorFactory, setPkGenerator, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, supportsBatchUpdates, supportsCatalogsOnReverseEngineering, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, typeSupportsLength, typeSupportsScale, unwrapModifier 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) Creates and returns a DbAttribute based on supplied parameters (usually obtained from database meta data).protected QuotingStrategyprotected voidcreateTableAppendPKClause(StringBuffer sqlBuffer, DbEntity entity) dropTableStatements(DbEntity table) Returns a collection of SQL statements needed to drop a database table.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 definitionbooleantypeSupportsScale(int type) Returns true if supplied type can have a scale attribute as a part of column definition.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, waitMethods inherited from interface DbAdapter
supportsGeneratedKeysForBatchInsertsModifier and TypeMethodDescriptiondefault booleanReturns true if a target database supports key autogeneration in a batch insert.
-
Field Details
-
TRIM_FUNCTION
- See Also:
-
-
Constructor Details
-
HSQLDBAdapter
public HSQLDBAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry)
-
-
Method Details
-
configureExtendedTypes
Description copied from class:JdbcAdapterCalled fromJdbcAdapter.initExtendedTypes(List, List, List, ValueObjectTypeRegistry)to load adapter-specific types into the ExtendedTypeMap right after the default types are loaded, but before the DI overrides are. This method has specific implementations in JdbcAdapter subclasses.- Overrides:
configureExtendedTypesin classJdbcAdapter- Since:
- 4.0
-
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:
- 4.0
-
getTableName
-
getSchemaName
-
getAction
-
createUniqueConstraint
Returns a DDL string to create a unique constraint over a set of columns.- Specified by:
createUniqueConstraintin interfaceDbAdapter- Overrides:
createUniqueConstraintin classJdbcAdapter- Since:
- 1.1
-
createFkConstraint
Adds an ADD CONSTRAINT clause to a relationship constraint.- Specified by:
createFkConstraintin interfaceDbAdapter- Overrides:
createFkConstraintin classJdbcAdapter- See Also:
-
createTable
Uses "CREATE CACHED TABLE" instead of "CREATE TABLE".- Specified by:
createTablein interfaceDbAdapter- Overrides:
createTablein classJdbcAdapter- Since:
- 1.2
-
createTableAppendColumn
Description copied from class:JdbcAdapterAppends SQL for column creation to CREATE TABLE buffer.- Specified by:
createTableAppendColumnin interfaceDbAdapter- Overrides:
createTableAppendColumnin classJdbcAdapter- Parameters:
sqlBuffer- theStringBufferto append the column type tocolumn- theDbAttributedefining the column to append type for
-