org.apache.cayenne.dba.postgres
Class PostgresPkGenerator

java.lang.Object
  extended by org.apache.cayenne.dba.JdbcPkGenerator
      extended by org.apache.cayenne.dba.oracle.OraclePkGenerator
          extended by org.apache.cayenne.dba.postgres.PostgresPkGenerator
All Implemented Interfaces:
PkGenerator

public class PostgresPkGenerator
extends OraclePkGenerator

Default PK generator for PostgreSQL that uses sequences for PK generation.


Field Summary
 
Fields inherited from class org.apache.cayenne.dba.JdbcPkGenerator
DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize
 
Constructor Summary
protected PostgresPkGenerator()
          Deprecated. since 3.0
protected PostgresPkGenerator(JdbcAdapter adapter)
           
 
Method Summary
protected  String createSequenceString(DbEntity ent)
           
protected  List<String> getExistingSequences(DataNode node)
          Fetches a list of existing sequences that might match Cayenne generated ones.
protected  long longPkFromDatabase(DataNode node, DbEntity entity)
          Generates primary key by calling Oracle sequence corresponding to the dbEntity.
protected  int pkFromDatabase(DataNode node, DbEntity ent)
          Deprecated. since 3.0
 
Methods inherited from class org.apache.cayenne.dba.oracle.OraclePkGenerator
createAutoPk, createAutoPkStatements, dropAutoPk, dropAutoPkStatements, dropSequenceString, pkCacheSize, sequenceName, stripSchemaName
 
Methods inherited from class org.apache.cayenne.dba.JdbcPkGenerator
autoPkTableExists, binaryPK, dropAutoPkString, generatePk, generatePkForDbEntity, getAdapter, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, reset, runUpdate, setPkCacheSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgresPkGenerator

protected PostgresPkGenerator()
Deprecated. since 3.0


PostgresPkGenerator

protected PostgresPkGenerator(JdbcAdapter adapter)
Method Detail

createSequenceString

protected String createSequenceString(DbEntity ent)
Overrides:
createSequenceString in class OraclePkGenerator

longPkFromDatabase

protected long longPkFromDatabase(DataNode node,
                                  DbEntity entity)
                           throws Exception
Description copied from class: OraclePkGenerator
Generates primary key by calling Oracle sequence corresponding to the dbEntity. Executed SQL looks like this:
   SELECT pk_table_name.nextval FROM DUAL
 

Overrides:
longPkFromDatabase in class OraclePkGenerator
Throws:
Exception
Since:
3.0

pkFromDatabase

protected int pkFromDatabase(DataNode node,
                             DbEntity ent)
                      throws Exception
Deprecated. since 3.0

Generates primary key by calling Oracle sequence corresponding to the dbEntity. Executed SQL looks like this:
     SELECT nextval(pk_table_name)
 

Overrides:
pkFromDatabase in class OraclePkGenerator
Throws:
Exception

getExistingSequences

protected List<String> getExistingSequences(DataNode node)
                                     throws SQLException
Fetches a list of existing sequences that might match Cayenne generated ones.

Overrides:
getExistingSequences in class OraclePkGenerator
Throws:
SQLException


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