com.solarmetric.kodo.impl.jdbc.schema
Class ClassSequenceFactory
java.lang.Object
|
+--com.solarmetric.kodo.impl.jdbc.schema.ClassSequenceFactory
- All Implemented Interfaces:
- SequenceFactory, Serializable
- public class ClassSequenceFactory
- extends Object
- implements SequenceFactory
SequenceFactory implementation that uses a
sequence per class to generate numbers.
It checks for the extension "sequence" under class-leve
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEQUENCE_EXT
public static final String SEQUENCE_EXT
ClassSequenceFactory
public ClassSequenceFactory()
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}"
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
- Get the next sequence from the proper table defined in the
metadata.
- Specified by:
getNext in interface SequenceFactory
Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.