Package org.apache.cayenne.dba.postgres
Class PostgresAdapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.postgres.PostgresAdapter
- All Implemented Interfaces:
- DbAdapter
public class PostgresAdapter extends JdbcAdapter
DbAdapter implementation for PostgreSQL
 RDBMS . Sample connection settings to use with PostgreSQL are shown
 below:
 
 
      postgres.jdbc.username = test
      postgres.jdbc.password = secret
      postgres.jdbc.url = jdbc:postgresql://serverhostname/cayenne
      postgres.jdbc.driver = org.postgresql.Driver
 - 
Field SummaryFields inherited from class org.apache.cayenne.dba.JdbcAdapterbatchQueryBuilderFactory, caseInsensitiveCollations, ejbqlTranslatorFactory, extendedTypes, logger, quotingStrategy, resourceLocator, supportsBatchUpdates, supportsGeneratedKeys, supportsUniqueConstraints, typesHandler
- 
Constructor SummaryConstructors Constructor Description PostgresAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry)
- 
Method SummaryModifier and Type Method Description voidbindParameter(PreparedStatement statement, ParameterBinding binding)Binds an object value to PreparedStatement's parameter.DbAttributebuildAttribute(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 voidconfigureExtendedTypes(ExtendedTypeMap map)Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.protected PkGeneratorcreatePkGenerator()Creates and returns a primary key generator.StringcreateTable(DbEntity ent)Customizes table creating procedure for PostgreSQL.Collection<String>dropTableStatements(DbEntity table)Adds the CASCADE option to the DROP TABLE clause.SQLActiongetAction(Query query, DataNode node)Uses PostgresActionBuilder to create the right action.QualifierTranslatorgetQualifierTranslator(QueryAssembler queryAssembler)Returns a trimming translator.SelectTranslatorgetSelectTranslator(SelectQuery<?> query, EntityResolver entityResolver)Returns a SelectTranslator that works with the adapter target database.booleansupportsCatalogsOnReverseEngineering()Returns true.booleantypeSupportsLength(int type)Returns true if supplied type can have a length attribute as a part of column definitionMethods inherited from class org.apache.cayenne.dba.JdbcAdaptercreateEJBQLTranslatorFactory, createFkConstraint, createQuotingStrategy, createTableAppendColumn, createTableAppendPKClause, createUniqueConstraint, externalTypesForJdbcType, findResource, getBatchTerminator, getEjbqlTranslatorFactory, getExtendedTypes, getJdbcEventLogger, getPkGenerator, getQuotingStrategy, getSystemCatalogs, getSystemSchemas, getType, initExtendedTypes, setEjbqlTranslatorFactory, setPkGenerator, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, supportsBatchUpdates, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, unwrap
- 
Field Details- 
BYTEA- See Also:
- Constant Field Values
 
 
- 
- 
Constructor Details- 
PostgresAdapterpublic PostgresAdapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ResourceLocator resourceLocator, ValueObjectTypeRegistry valueObjectTypeRegistry)
 
- 
- 
Method Details- 
getSelectTranslatorDescription copied from interface:DbAdapterReturns a SelectTranslator that works with the adapter target database.- Specified by:
- getSelectTranslatorin interface- DbAdapter
- Overrides:
- getSelectTranslatorin class- JdbcAdapter
- Since:
- 4.0
 
- 
getActionUses PostgresActionBuilder to create the right action.- Specified by:
- getActionin interface- DbAdapter
- Overrides:
- getActionin class- JdbcAdapter
- Since:
- 1.2
 
- 
configureExtendedTypesInstalls appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.- Overrides:
- configureExtendedTypesin class- JdbcAdapter
 
- 
buildAttributepublic DbAttribute buildAttribute(String name, String typeName, int type, int size, int scale, boolean allowNulls)Description copied from interface:DbAdapterCreates and returns a DbAttribute based on supplied parameters (usually obtained from database meta data).- Specified by:
- buildAttributein interface- DbAdapter
- Overrides:
- buildAttributein class- JdbcAdapter
- Parameters:
- name- database column name
- typeName- database specific type name, may be used as a hint to determine the right JDBC type.
- type- JDBC column type
- size- 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
 
- 
bindParameterpublic void bindParameter(PreparedStatement statement, ParameterBinding binding) throws SQLException, ExceptionDescription copied from interface:DbAdapterBinds an object value to PreparedStatement's parameter.- Specified by:
- bindParameterin interface- DbAdapter
- Overrides:
- bindParameterin class- JdbcAdapter
- Throws:
- SQLException
- Exception
 
- 
createTableCustomizes 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 interface- DbAdapter
- Overrides:
- createTablein class- JdbcAdapter
- Since:
- 1.0.2
 
- 
typeSupportsLengthpublic 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 interface- DbAdapter
- Overrides:
- typeSupportsLengthin class- JdbcAdapter
 
- 
dropTableStatementsAdds the CASCADE option to the DROP TABLE clause.- Specified by:
- dropTableStatementsin interface- DbAdapter
- Overrides:
- dropTableStatementsin class- JdbcAdapter
 
- 
getQualifierTranslatorReturns a trimming translator.- Specified by:
- getQualifierTranslatorin interface- DbAdapter
- Overrides:
- getQualifierTranslatorin class- JdbcAdapter
 
- 
createPkGeneratorDescription copied from class:JdbcAdapterCreates and returns a primary key generator. This factory method should be overriden by JdbcAdapter subclasses to provide custom implementations of PKGenerator.- Overrides:
- createPkGeneratorin class- JdbcAdapter
- See Also:
- JdbcAdapter.createPkGenerator()
 
- 
supportsCatalogsOnReverseEngineeringpublic boolean supportsCatalogsOnReverseEngineering()Description copied from class:JdbcAdapterReturns true.- Specified by:
- supportsCatalogsOnReverseEngineeringin interface- DbAdapter
- Overrides:
- supportsCatalogsOnReverseEngineeringin class- JdbcAdapter
 
 
-