Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

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

All Implemented Interfaces:
  SequenceFactory, Serializable

public class TrueSequenceFactory
extends Object
implements SequenceFactory

`SequenceFactory` implementation that uses a singular database sequence to generate numbers. Named true as it attempts to use native database id generation. Note this will NOT work on databases that do not support sequences. Designed as an example for subclassing / re-implementation. Only tested on Oracle. Other databases may require subclassing or re-implementation using this class as a basis.

See Also:
  `SequenceFactory`, `DBDictionaryFactory`, Serialized Form

Constructor Summary
`TrueSequenceFactory()`

Method Summary
`String` | `getFormat()` Return the MessageFormat String to use for SQL generation
`long` | `getNext(Class cls, Connector connector)` Gets the next id by pulling the next value from the sequence
`String` | `getSequenceName()` Return the name of the sequence used
`String` | `getTableName()` Return the table name to run sequence queries against.
`static void` | `main(String[] args)` Usage: java com.solarmetric.kodo.impl.jdbc.schema.TrueSequenceFactory [option]* -action <increment>
`void` | `setConfiguration(JDBCConfiguration conf, DBDictionary dict)` Set the configuration for this factory; allows access to database connection information, etc.
`void` | `setFormat(String messageFormat)` Set the String used for MessageFormat to generate the sequence selecting SQL.
`void` | `setSequenceName(String seqName)` Set the sequence used.
`void` | `setTableName(String name)` Set the table name to run sequence queries against.

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

Constructor Detail

### TrueSequenceFactory

    public TrueSequenceFactory()

Method Detail

### getTableName

    public String getTableName()

  Return the table name to run sequence queries against.

### setTableName

    public void setTableName(String name)

  Set the table name to run sequence queries against. Defaults to DUAL.
  Parameters:
    `name` - the name of the table

### getFormat

    public String getFormat()

  Return the MessageFormat String to use for SQL generation

### setFormat

    public void setFormat(String messageFormat)

  Set the String used for MessageFormat to generate the sequence selecting SQL. Should have two placeholders, 0 for the sequence name and 1 for the table name (e.g. dual) Also, it converts $ to spaces to help with auto configuration Defaults to select {0}.NEXTVAL from {1}

### getSequenceName

    public String getSequenceName()

  Return the name of the sequence used

### setSequenceName

    public void setSequenceName(String seqName)

  Set the sequence used. defaults to JDOSEQUENCE

### setConfiguration

    public void setConfiguration(JDBCConfiguration conf,
                                 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`

### getNext

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

  Gets the next id by pulling the next value from the sequence
  Specified by:
    `getNext` in interface `SequenceFactory`

### main

    public static void main(String[] args)
                     throws SQLException

  Usage: java com.solarmetric.kodo.impl.jdbc.schema.TrueSequenceFactory [option]* -action <increment>

  Where the following options are recognized.

  - -properties <properties file>: the path to a Kodo properties file containing information such as the license key and connection data as outlined in `Configuration`; optional
  - -<bean property> <value>: all bean properties of the Kodo `JDBCConfiguration` can be set by using their names and supplying a value; for example: `-licenseKey adslfja83r3lkadf`

  If the license key is not specified otherwise, Kodo will check for default preference files with license keys as outlined in `DefaultConfiguration`.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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