Class PostgresAdapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.postgres.PostgresAdapter
- All Implemented Interfaces:
DbAdapter
DbAdapter implementation for PostgreSQL RDBMS
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPostgresAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry) -
Method Summary
Modifier and TypeMethodDescriptionbuildAttribute(String name, String typeName, int type, int maxLength, int scale, boolean allowNulls) Creates and returns a DbAttribute based on supplied parameters (usually obtained from database metadata).protected voidInstalls appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.protected NativeColumnType[]Returns the database-native types supported by this adapter.Returns aPostgresPkGenerator.createTable(DbEntity ent) Customizes table creating procedure for PostgreSQL.dropTableStatements(DbEntity table) Adds the CASCADE option to the DROP TABLE clause.Uses PostgresActionBuilder to create the right action.getProcedureTranslator(ProcedureQuery query, EntityResolver entityResolver) Returns theProcedureTranslatorfor the given query.intpreferredBindingType(int jdbcType) Returns the JDBC type that this adapter prefers to bind for a given mapped JDBC type.booleanReturns true.booleantypeSupportsLength(int type) Returns true if supplied type can have a length attribute as a part of column definitionMethods inherited from class JdbcAdapter
bind, bindParameter, bindParameter, createEJBQLTranslator, createFkConstraint, createQuotingStrategy, createTableAppendColumn, createTableAppendPKClause, createUniqueConstraint, defaultCharColumnLength, externalTypesForJdbcType, getBatchTerminator, getEjbqlTranslator, getExtendedTypes, getQuotingStrategy, getQuotingStrategy, getSelectTranslator, getSQLLogger, getSystemCatalogs, getType, initExtendedTypes, nativeColumnTypes, setEjbqlTranslator, setEjbqlTranslatorFactory, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, sizeAndScale, supportsBatchUpdates, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, typeSupportsScale, unwrapMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DbAdapter
getEjbqlTranslatorFactory, preferredNativeColumnType, supportsGeneratedKeysForBatchInserts
-
Field Details
-
BYTEA
- See Also:
-
-
Constructor Details
-
PostgresAdapter
public PostgresAdapter(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
-
createPkGenerator
Returns aPostgresPkGenerator.- 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
-
getAction
-
getProcedureTranslator
public ProcedureTranslator getProcedureTranslator(ProcedureQuery query, EntityResolver entityResolver) Description copied from interface:DbAdapterReturns theProcedureTranslatorfor the given query. The default implementation ignores the query, but the parameter is retained so adapters can pick a translator based on it.- Specified by:
getProcedureTranslatorin interfaceDbAdapter- Overrides:
getProcedureTranslatorin classJdbcAdapter- Since:
- 5.0
-
configureExtendedTypes
Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.- Overrides:
configureExtendedTypesin classJdbcAdapter
-
buildAttribute
public DbAttribute buildAttribute(String name, String typeName, int type, int maxLength, int scale, boolean allowNulls) Description copied from interface:DbAdapterCreates and returns a DbAttribute based on supplied parameters (usually obtained from database metadata).- 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 typemaxLength- 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
-
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. -
createTable
Customizes table creating procedure for PostgreSQL. One difference with generic implementation is that "bytea" type has no explicit length unlike similar binary types in other databases.- Specified by:
createTablein interfaceDbAdapter- Overrides:
createTablein classJdbcAdapter- Since:
- 1.0.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
-
dropTableStatements
Adds the CASCADE option to the DROP TABLE clause.- Specified by:
dropTableStatementsin interfaceDbAdapter- Overrides:
dropTableStatementsin classJdbcAdapter
-
supportsCatalogsOnReverseEngineering
public boolean supportsCatalogsOnReverseEngineering()Description copied from class:JdbcAdapterReturns true.- Specified by:
supportsCatalogsOnReverseEngineeringin interfaceDbAdapter- Overrides:
supportsCatalogsOnReverseEngineeringin classJdbcAdapter
-
getSystemSchemas
- Specified by:
getSystemSchemasin interfaceDbAdapter- Overrides:
getSystemSchemasin classJdbcAdapter- Returns:
- list of system schemas
-