SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

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

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

public class ClassSequenceFactory
extends AbstractSequenceFactory
implements SequenceFactory

SequenceFactory implementation that uses a sequence per class to generate numbers. It checks for the extension "sequence" under class-level metadata. Note that much of the code here is duplicated across TrueSequenceFactory. The code is separated for clarity to plug-in developers. 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

Field Summary
static String SEQUENCE_EXT
           
 
Constructor Summary
ClassSequenceFactory()
           
 
Method Summary
 String getFormat()
          Return the MessageFormat String to use as for SQL generation
 long getNext(Class cls, Connector connector)
          Get the next sequence from the proper table defined in the metadata.
 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 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
 
Methods inherited from interface com.solarmetric.kodo.impl.jdbc.SequenceFactory
setConfiguration
 

Field Detail

SEQUENCE_EXT

public static final String SEQUENCE_EXT
Constructor Detail

ClassSequenceFactory

public ClassSequenceFactory()
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 as 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}"

getNext

public long getNext(Class cls,
                    Connector connector)
             throws SQLException
Get the next sequence from the proper table defined in the metadata.
Specified by:
getNext in interface SequenceFactory

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

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