SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

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

java.lang.Object
  |
  +--com.solarmetric.kodo.impl.jdbc.schema.AbstractSequenceFactory
        |
        +--com.solarmetric.kodo.impl.jdbc.schema.TrueSequenceFactory
All Implemented Interfaces:
SequenceFactory, Serializable

public class TrueSequenceFactory
extends AbstractSequenceFactory

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.
 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 com.solarmetric.kodo.impl.jdbc.schema.AbstractSequenceFactory
getConfiguration, getDictionary, setConfiguration, setConfiguration, setDictionary
 
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

getNext

public long getNext(Class cls,
                    Connector connector)
             throws SQLException
Gets the next id by pulling the next value from the sequence

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

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