Package org.castor.ddlgen.keygenerator
Class SequenceKeyGenerator
- java.lang.Object
-
- org.castor.ddlgen.schemaobject.AbstractSchemaObject
-
- org.castor.ddlgen.schemaobject.KeyGenerator
-
- org.castor.ddlgen.keygenerator.SequenceKeyGenerator
-
- All Implemented Interfaces:
SchemaObject
public final class SequenceKeyGenerator extends KeyGenerator
SEQUENCE key generator can be used only with Oracle, PostgreSQL, Interbase and SAP DB. It generates keys using sequences.- Since:
- 1.1
- Version:
- $Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
- Author:
- Le Duc Bao, Ralf Joachim
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALGORITHM_NAME
Name of key generator algorithm.-
Fields inherited from class org.castor.ddlgen.schemaobject.AbstractSchemaObject
HASHFACTOR
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SequenceKeyGenerator(SequenceKeyGeneratorFactory factory)
Constructor for default SEQUENCE key generator.protected
SequenceKeyGenerator(SequenceKeyGeneratorFactory factory, KeyGeneratorDef definition)
Constructor for SEQUENCE key generator specified by given defintion.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIncrement()
Get increment for the sequence.java.lang.String
getSequence()
Get name of the sequence.boolean
isReturning()
Get returning mode for the sequence.boolean
isTrigger()
Shell a trigger be used to generates keys?void
toCreateDDL(DDLWriter writer)
Delegate generation of create script to factory.void
toDropDDL(DDLWriter writer)
Delegate generation of drop script to factory.-
Methods inherited from class org.castor.ddlgen.schemaobject.KeyGenerator
equals, getAlias, getTable, hashCode, merge, setAlias, setTable
-
Methods inherited from class org.castor.ddlgen.schemaobject.AbstractSchemaObject
equals, getConfiguration, getName, setConfiguration, setName
-
-
-
-
Field Detail
-
ALGORITHM_NAME
public static final java.lang.String ALGORITHM_NAME
Name of key generator algorithm.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SequenceKeyGenerator
protected SequenceKeyGenerator(SequenceKeyGeneratorFactory factory)
Constructor for default SEQUENCE key generator.- Parameters:
factory
- The key generator factory that has created this key generator and will also be responsible to generate the DDL for the sequence.
-
SequenceKeyGenerator
protected SequenceKeyGenerator(SequenceKeyGeneratorFactory factory, KeyGeneratorDef definition) throws GeneratorException
Constructor for SEQUENCE key generator specified by given defintion.- Parameters:
factory
- The key generator factory that has created this key generator and will also be responsible to generate the DDL for the sequence.definition
- Key generator definition.- Throws:
GeneratorException
- If increment parameter can't be parsed as integer.
-
-
Method Detail
-
getSequence
public java.lang.String getSequence()
Get name of the sequence.- Returns:
- Name of the sequence.
-
isReturning
public boolean isReturning()
Get returning mode for the sequence.- Returns:
- Returning mode for the sequence.
-
isTrigger
public boolean isTrigger()
Shell a trigger be used to generates keys?- Returns:
true
if keys are to be generated by a trigger,false
otherwise.
-
getIncrement
public int getIncrement()
Get increment for the sequence.- Returns:
- Increment for the sequence.
-
toCreateDDL
public void toCreateDDL(DDLWriter writer)
Delegate generation of create script to factory.
Build create script for the schema object.- Parameters:
writer
- DDLWriter to write schema objects to.
-
toDropDDL
public void toDropDDL(DDLWriter writer)
Delegate generation of drop script to factory.
Build drop script for the schema object.- Parameters:
writer
- DDLWriter to write schema objects to.
-
-