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:

    
      test-postgresql.cayenne.adapter = org.apache.cayenne.dba.postgres.PostgresAdapter
      test-postgresql.jdbc.username = test
      test-postgresql.jdbc.password = secret
      test-postgresql.jdbc.url = jdbc:postgresql://serverhostname/cayenne
      test-postgresql.jdbc.driver = org.postgresql.Driver
     
 

Author:
Dirk Olmes, Holger Hoffstaette, Andrus Adamchik

Field Summary
 
Fields inherited from class org.apache.cayenne.dba.JdbcAdapter
extendedTypes, pkGenerator, supportsBatchUpdates, supportsFkConstraints, supportsGeneratedKeys, supportsUniqueConstraints, typesHandler
 
Constructor Summary
PostgresAdapter()
           
 
Method Summary
 DbAttribute buildAttribute(java.lang.String name, java.lang.String typeName, int type, int size, int precision, 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.
 java.lang.String createTable(DbEntity ent)
          Customizes table creating procedure for PostgreSQL.
 java.lang.String dropTable(DbEntity ent)
          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.
 
Methods inherited from class org.apache.cayenne.dba.JdbcAdapter
bindParameter, createDataNode, createFkConstraint, createTableAppendColumn, createTableAppendPKClause, createUniqueConstraint, externalTypesForJdbcType, findAdapterResource, getBatchTerminator, getExtendedTypes, getPkGenerator, getQueryTranslator, queryTranslatorClass, setPkGenerator, setSupportsBatchUpdates, setSupportsFkConstraints, setSupportsGeneratedKeys, setSupportsUniqueConstraints, shouldRunBatchQuery, 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(java.lang.String name,
                                  java.lang.String typeName,
                                  int type,
                                  int size,
                                  int precision,
                                  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)
precision - database column precision (ignored if less than zero)
allowNulls - database column nullable parameter

createTable

public java.lang.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

dropTable

public java.lang.String dropTable(DbEntity ent)
Adds the CASCADE option to the DROP TABLE clause.

Specified by:
dropTable in interface DbAdapter
Overrides:
dropTable in class JdbcAdapter
See Also:
JdbcAdapter.dropTable(DbEntity)

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()


Copyright © 2001-2006 Apache.org All Rights Reserved.