Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.impl.jdbc.schema
Class DBSequenceFactory

    java.lang.Object
      |
      +--com.solarmetric.kodo.impl.jdbc.schema.AbstractSequenceFactory
            |
            +--com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory

All Implemented Interfaces:
  SchemaSequenceFactory, SequenceFactory, Serializable

Direct Known Subclasses:
  ClassDBSequenceFactory

public class DBSequenceFactory
extends AbstractSequenceFactory
implements SchemaSequenceFactory

`SequenceFactory` implementation that uses a database table for sequence number generation. The table is created by the `SchemaTool`.

See Also:
  Serialized Form

Field Summary
`(package private) Column` | `_pkColumn`
`(package private) ClassResolver` | `_resolver`
`(package private) Column` | `_seqColumn`

Constructor Summary
`DBSequenceFactory()`

Method Summary
`(package private) Table` | `buildTable()` Creates the object-level representation of the sequence table.
`(package private) void` | `dropTable(SQLExecutionManager manager)` Deprecated. Schema refreshing is not longer done at runtime via the `initializeSchema(com.solarmetric.kodo.impl.jdbc.schema.SchemaTool, java.lang.Class)` method.
`static Long` | `getCurrentSequence(SQLExecutionManager manager, boolean failOnMissing, Select select)` Uses the given `Select` to obtain the current value of the sequence, or null if there were no results.
`int` | `getIncrement()` Return the increment to us when updating the sequence table.
`long` | `getNext(Class cls, Connector connector)` Return a unique primary key value for the given class.
`(package private) SQLBuffer` | `getSequenceSeed(Class type)`
`(package private) Select` | `getSequenceSelect(Class type)`
`String` | `getTableName()` Return the table name to use to store sequence ids.
`void` | `initializeSchema(SchemaTool tool, Class type)` Initialize the schema.
`(package private) void` | `refreshTable(SQLExecutionManager manager)` Deprecated. Schema refreshing is not longer done at runtime via the `initializeSchema(com.solarmetric.kodo.impl.jdbc.schema.SchemaTool, java.lang.Class)` method.
`void` | `setConfiguration(JDBCConfiguration config, DBDictionary dict)` Set the configuration for this factory; allows access to database connection information, etc.
`void` | `setIncrement(int inc)` Set the increment to use when updating the sequence table.
`void` | `setTableName(String name)` Set the table name for storing sequence ids.
`(package private) void` | `updateSequence(Class cls, SQLExecutionManager manager)` Grabs the next handful of sequence numbers.

Methods inherited from class com.solarmetric.kodo.impl.jdbc.schema.AbstractSequenceFactory
`getConfiguration, getDictionary, setConfiguration, setDictionary`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _pkColumn

    transient Column _pkColumn

### _seqColumn

    transient Column _seqColumn

### _resolver

    final ClassResolver _resolver

Constructor Detail

### DBSequenceFactory

    public DBSequenceFactory()

Method Detail

### getTableName

    public String getTableName()

  Return the table name to use to store sequence ids.

### setTableName

    public void setTableName(String name)

  Set the table name for storing sequence ids. Defaults to JDO_SEQUENCE. Note that this table name will be further altered by the `DBDictionary`

### getIncrement

    public int getIncrement()

  Return the increment to us when updating the sequence table. Sequence numbers will be grabbed in blocks of this value to reduce the number of transactions that must be performed on the sequence table.

### setIncrement

    public void setIncrement(int inc)

  Set the increment to use when updating the sequence table. Defaults to 50, meaning a transaction has to take place on the sequence table only every 50 new objects created.

### getNext

    public long getNext(Class cls,
                        Connector connector)
                 throws SQLException

  Description copied from interface: `SequenceFactory`
  Return a unique primary key value for the given class.
  Specified by:
    `getNext` in interface `SequenceFactory`

### initializeSchema

    public void initializeSchema(SchemaTool tool,
                                 Class type)
                          throws SQLException

  Initialize the schema.
  Specified by:
    `initializeSchema` in interface `SchemaSequenceFactory`
  Following copied from interface: `com.solarmetric.kodo.impl.jdbc.schema.SchemaSequenceFactory`
  Parameters:
    `manager` - the `SQLExecutionManager` to use.
    `type` - the class that this sequence factory is being initialize for.

### refreshTable

    final void refreshTable(SQLExecutionManager manager)
                     throws SQLException

  Deprecated. Schema refreshing is not longer done at runtime via the `initializeSchema(com.solarmetric.kodo.impl.jdbc.schema.SchemaTool, java.lang.Class)` method.

  Creates the sequence table in the DB.

### getSequenceSeed

    SQLBuffer getSequenceSeed(Class type)

### dropTable

    final void dropTable(SQLExecutionManager manager)
                  throws SQLException

  Deprecated. Schema refreshing is not longer done at runtime via the `initializeSchema(com.solarmetric.kodo.impl.jdbc.schema.SchemaTool, java.lang.Class)` method.

  Drops the sequence table in the DB.

### setConfiguration

    public void setConfiguration(JDBCConfiguration config,
                                 DBDictionary dict)

  Description copied from interface: `SequenceFactory`
  Set the configuration for this factory; allows access to database connection information, etc.
  Specified by:
    `setConfiguration` in interface `SequenceFactory`
  Overrides:
    `setConfiguration` in class `AbstractSequenceFactory`

### buildTable

    Table buildTable()

  Creates the object-level representation of the sequence table.

### updateSequence

    void updateSequence(Class cls,
                        SQLExecutionManager manager)
                  throws SQLException

  Grabs the next handful of sequence numbers.

### getSequenceSelect

    Select getSequenceSelect(Class type)

### getCurrentSequence

    public static Long getCurrentSequence(SQLExecutionManager manager,
                                          boolean failOnMissing,
                                          Select select)
                                   throws SQLException

  Uses the given `Select` to obtain the current value of the sequence, or null if there were no results.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.