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

## org.objectstyle.cayenne.dba
Interface PkGenerator

All Known Implementing Classes:
  DB2PkGenerator, DerbyPkGenerator, FirebirdPkGenerator, FrontBasePkGenerator, IngresPkGenerator, JdbcPkGenerator, MySQLPkGenerator, OpenBasePkGenerator, OraclePkGenerator, PostgresPkGenerator, SybasePkGenerator

    public interface PkGenerator

Defines methods to support automatic primary key generation.

Author:
  Andrei Adamchik

Method Summary
`void` | `createAutoPk(DataNode node, java.util.List dbEntities)` Generates necessary database objects to provide automatic primary key support.
`java.util.List` | `createAutoPkStatements(java.util.List dbEntities)` Returns a list of SQL strings needed to generates database objects to provide automatic primary support for the list of entities.
`void` | `dropAutoPk(DataNode node, java.util.List dbEntities)` Drops any common database objects associated with automatic primary key generation process.
`java.util.List` | `dropAutoPkStatements(java.util.List dbEntities)` Returns SQL string needed to drop database objects associated with automatic primary key generation.
`java.lang.Object` | `generatePkForDbEntity(DataNode dataNode, DbEntity ent)` Generates new (unique and non-repeating) primary key for specified DbEntity.
`java.lang.String` | `generatePkForDbEntityString(DbEntity ent)` Deprecated. Since 1.2. This method is not used.
`void` | `reset()` Resets any cached primary keys forcing generator to go to the database next time id generation is requested.

Method Detail

### createAutoPk

    void createAutoPk(DataNode node,
                      java.util.List dbEntities)
                      throws java.lang.Exception

  Generates necessary database objects to provide automatic primary key support.

  Parameters:
    `node` - node that provides access to a DataSource.
    `dbEntities` - a list of entities that require primary key autogeneration support
  Throws:
    `java.lang.Exception`

### createAutoPkStatements

    java.util.List createAutoPkStatements(java.util.List dbEntities)

  Returns a list of SQL strings needed to generates database objects to provide automatic primary support for the list of entities. No actual database operations are performed.

### dropAutoPk

    void dropAutoPk(DataNode node,
                    java.util.List dbEntities)
                    throws java.lang.Exception

  Drops any common database objects associated with automatic primary key generation process. This may be lookup tables, special stored procedures or sequences.

  Parameters:
    `node` - node that provides access to a DataSource.
    `dbEntities` - a list of entities whose primary key autogeneration support should be dropped.
  Throws:
    `java.lang.Exception`

### dropAutoPkStatements

    java.util.List dropAutoPkStatements(java.util.List dbEntities)

  Returns SQL string needed to drop database objects associated with automatic primary key generation. No actual database operations are performed.

### generatePkForDbEntity

    java.lang.Object generatePkForDbEntity(DataNode dataNode,
                                           DbEntity ent)
                                           throws java.lang.Exception

  Generates new (unique and non-repeating) primary key for specified DbEntity.

  Parameters:
    `ent` - DbEntity for which automatic PK is generated.
  Throws:
    `java.lang.Exception`

### generatePkForDbEntityString

    java.lang.String generatePkForDbEntityString(DbEntity ent)

  Deprecated. Since 1.2. This method is not used.

  Returns SQL string that can generate new (unique and non-repeating) primary key for specified DbEntity. No actual database operations are performed.

### reset

    void reset()

  Resets any cached primary keys forcing generator to go to the database next time id generation is requested. May not be applicable for all generator implementations.

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 ObjectStyle.org All Rights Reserved.