org.apache.cayenne.dba.postgres
Class PostgresAdapter

java.lang.Object
  extended by org.apache.cayenne.dba.JdbcAdapter
      extended by 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.cayenne.adapter = org.apache.cayenne.dba.postgres.PostgresAdapter
      postgres.jdbc.username = test
      postgres.jdbc.password = secret
      postgres.jdbc.url = jdbc:postgresql://serverhostname/cayenne
      postgres.jdbc.driver = org.postgresql.Driver
     
 


Field Summary
 
Fields inherited from class org.apache.cayenne.dba.JdbcAdapter
ejbqlTranslatorFactory, extendedTypes, identifiersEndQuote, identifiersStartQuote, pkGenerator, supportsBatchUpdates, supportsFkConstraints, supportsGeneratedKeys, supportsUniqueConstraints, typesHandler
 
Constructor Summary
PostgresAdapter()
           
 
Method Summary
 DbAttribute 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  void configureExtendedTypes(ExtendedTypeMap map)
          Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.
protected  PkGenerator createPkGenerator()
          Creates and returns a primary key generator.
 String createTable(DbEntity ent)
          Customizes table creating procedure for PostgreSQL.
 Collection<String> dropTableStatements(DbEntity table)
          Adds the CASCADE option to the DROP TABLE clause.
 SQLAction getAction(Query query, DataNode node)
          Uses PostgresActionBuilder to create the right action.
 QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler)
          Returns a trimming translator.
 MergerFactory mergerFactory()
           
 
Methods inherited from class org.apache.cayenne.dba.JdbcAdapter
bindParameter, createEJBQLTranslatorFactory, createFkConstraint, createTableAppendColumn, createTableAppendPKClause, createUniqueConstraint, dropTable, externalTypesForJdbcType, findAdapterResource, findResource, getBatchTerminator, getEjbqlTranslatorFactory, getExtendedTypes, getIdentifiersEndQuote, getIdentifiersStartQuote, getPkGenerator, getQuotingStrategy, initIdentifiersQuotes, setEjbqlTranslatorFactory, setPkGenerator, setSupportsBatchUpdates, setSupportsFkConstraints, setSupportsGeneratedKeys, setSupportsUniqueConstraints, supportsBatchUpdates, supportsFkConstraints, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgresAdapter

public PostgresAdapter()
Method Detail

getAction

public SQLAction getAction(Query query,
                           DataNode node)
Uses PostgresActionBuilder to create the right action.

Specified by:
getAction in interface DbAdapter
Overrides:
getAction in class JdbcAdapter
Since:
1.2

configureExtendedTypes

protected void configureExtendedTypes(ExtendedTypeMap map)
Installs appropriate ExtendedTypes as converters for passing values between JDBC and Java layers.

Overrides:
configureExtendedTypes in class JdbcAdapter

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 interface DbAdapter
Overrides:
buildAttribute in 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

createTable

public String createTable(DbEntity ent)
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:
createTable in interface DbAdapter
Overrides:
createTable in class JdbcAdapter
Since:
1.0.2

dropTableStatements

public Collection<String> dropTableStatements(DbEntity table)
Adds the CASCADE option to the DROP TABLE clause.

Specified by:
dropTableStatements in interface DbAdapter
Overrides:
dropTableStatements in class JdbcAdapter

getQualifierTranslator

public QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler)
Returns a trimming translator.

Specified by:
getQualifierTranslator in interface DbAdapter
Overrides:
getQualifierTranslator in class JdbcAdapter

createPkGenerator

protected PkGenerator createPkGenerator()
Description copied from class: JdbcAdapter
Creates and returns a primary key generator. This factory method should be overriden by JdbcAdapter subclasses to provide custom implementations of PKGenerator.

Overrides:
createPkGenerator in class JdbcAdapter
See Also:
JdbcAdapter.createPkGenerator()

mergerFactory

public MergerFactory mergerFactory()
Specified by:
mergerFactory in interface DbAdapter
Overrides:
mergerFactory in class JdbcAdapter


Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.