Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.dba.postgres
Class PostgresPkGenerator

    java.lang.Object
      org.apache.cayenne.dba.JdbcPkGenerator
          org.apache.cayenne.dba.oracle.OraclePkGenerator
              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, NEXT_ID, objDesc, pkCache, pkCacheSize, resultDesc`

Constructor Summary
`PostgresPkGenerator()`

Method Summary
`protected java.lang.String` | `createSequenceString(DbEntity ent)`
`protected java.util.List` | `getExistingSequences(DataNode node)` Fetches a list of existing sequences that might match Cayenne generated ones.
`protected int` | `pkFromDatabase(DataNode node, DbEntity ent)` Generates primary key by calling Oracle sequence corresponding to the `dbEntity`.

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, generatePkForDbEntity, generatePkForDbEntityString, 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

    public PostgresPkGenerator()

Method Detail

### createSequenceString

    protected java.lang.String createSequenceString(DbEntity ent)

  Overrides:
    `createSequenceString` in class `OraclePkGenerator`

### pkFromDatabase

    protected int pkFromDatabase(DataNode node,
                                 DbEntity ent)
                          throws java.lang.Exception

  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:
    `java.lang.Exception`

### getExistingSequences

    protected java.util.List getExistingSequences(DataNode node)
                                           throws java.sql.SQLException

  Fetches a list of existing sequences that might match Cayenne generated ones.

  Overrides:
    `getExistingSequences` in class `OraclePkGenerator`
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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