Class 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 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.