Package org.apache.cayenne.dba.h2
Class H2Adapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.h2.H2Adapter
- All Implemented Interfaces:
DbAdapter
DbAdapter implementation for H2
RDBMS . Sample connection settings to use with H2 are shown
below:
postgres.jdbc.username = sa postgres.jdbc.password = postgres.jdbc.url = jdbc:h2:cayenne postgres.jdbc.driver = org.h2.Driver
- Since:
- 3.0
-
Field Summary
Fields inherited from class org.apache.cayenne.dba.JdbcAdapter
caseInsensitiveCollations, ejbqlTranslatorFactory, extendedTypes, logger, quotingStrategy, resourceLocator, supportsBatchUpdates, supportsGeneratedKeys, supportsUniqueConstraints, typesHandler
-
Constructor Summary
ConstructorsConstructorDescriptionH2Adapter
(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry) -
Method Summary
Modifier and TypeMethodDescriptionbuildAttribute
(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 void
Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.protected EJBQLTranslatorFactory
Creates and returns anEJBQLTranslatorFactory
used to generate visitors for EJBQL to SQL translations.void
createTableAppendColumn
(StringBuffer sqlBuffer, DbAttribute column) Appends SQL for column creation to CREATE TABLE buffer.Uses JdbcActionBuilder to create the right action.Methods inherited from class org.apache.cayenne.dba.JdbcAdapter
bindParameter, createFkConstraint, createQuotingStrategy, createTable, createTableAppendPKClause, createUniqueConstraint, 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, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.cayenne.dba.DbAdapter
supportsGeneratedKeysForBatchInserts
-
Constructor Details
-
H2Adapter
public H2Adapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry)
-
-
Method Details
-
createTableAppendColumn
Description copied from class:JdbcAdapter
Appends SQL for column creation to CREATE TABLE buffer.- Specified by:
createTableAppendColumn
in interfaceDbAdapter
- Overrides:
createTableAppendColumn
in classJdbcAdapter
- Parameters:
sqlBuffer
- theStringBuffer
to append the column type tocolumn
- theDbAttribute
defining the column to append type for
-
getSqlTreeProcessor
- Specified by:
getSqlTreeProcessor
in interfaceDbAdapter
- Overrides:
getSqlTreeProcessor
in classJdbcAdapter
- Returns:
SQLTreeProcessor
that can adjust SQL tree to specific database flavour- Since:
- 4.2
-
createEJBQLTranslatorFactory
Description copied from class:JdbcAdapter
Creates and returns anEJBQLTranslatorFactory
used to generate visitors for EJBQL to SQL translations. This method should be overriden by subclasses that need to customize EJBQL generation.- Overrides:
createEJBQLTranslatorFactory
in classJdbcAdapter
- Returns:
- translator factory for EJBQL queries
- Since:
- 5.0
-
getAction
Description copied from class:JdbcAdapter
Uses JdbcActionBuilder to create the right action.- Specified by:
getAction
in interfaceDbAdapter
- Overrides:
getAction
in classJdbcAdapter
-
configureExtendedTypes
Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.- Overrides:
configureExtendedTypes
in classJdbcAdapter
- Since:
- 4.1.2
-
buildAttribute
public DbAttribute buildAttribute(String name, String typeName, int type, int size, int scale, boolean allowNulls) Description copied from interface:DbAdapter
Creates and returns a DbAttribute based on supplied parameters (usually obtained from database meta data).- Specified by:
buildAttribute
in interfaceDbAdapter
- Overrides:
buildAttribute
in 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
-