SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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

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

public class ClassSequenceFactory
extends java.lang.Object
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 seperated for clarity to plug-in developers.


Field Summary
static java.lang.String SEQUENCE_EXT
           
 
Constructor Summary
ClassSequenceFactory()
           
 
Method Summary
 java.lang.String getFormat()
          Return the MessageFormat string to use as for SQL generation.
 long getNext(java.lang.Class cls, java.lang.String user, java.lang.String pass)
          Return a unique primary key value.
 java.lang.String getTableName()
          Return the table name to run sequence queries against.
 void setConfiguration(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
          Set the configuration for this factory; allows access to database connection information, etc.
 void setFormat(java.lang.String messageFormat)
          Set the string used for MessageFormat to generate the sequence selecting SQL.
 void setTableName(java.lang.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
 

Field Detail

SEQUENCE_EXT

public static final java.lang.String SEQUENCE_EXT
See Also:
Constant Field Values
Constructor Detail

ClassSequenceFactory

public ClassSequenceFactory()
Method Detail

getTableName

public java.lang.String getTableName()
Return the table name to run sequence queries against.


setTableName

public void setTableName(java.lang.String name)
Set the table name to run sequence queries against. Defaults to DUAL.

Parameters:
name - the name of the table

getFormat

public java.lang.String getFormat()
Return the MessageFormat string to use as for SQL generation.


setFormat

public void setFormat(java.lang.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(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
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(java.lang.Class cls,
                    java.lang.String user,
                    java.lang.String pass)
Description copied from interface: SequenceFactory
Return a unique primary key value.

Specified by:
getNext in interface SequenceFactory
Parameters:
cls - the class of the object being persisted
user - the authentication information for connecting to the database
pass - the authentication information for connecting to the database

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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