All Implemented Interfaces:
Serializable, Cloneable

public class NativeSequence extends QuerySequence

Purpose: Define a database's native sequencing mechanism.

Description Many databases have built in support for sequencing. This can be a SEQUENCE object such as in Oracle, or a auto-incrementing column such as the IDENTITY field in Sybase. For an auto-incrementing column the preallocation size is always 1. For a SEQUENCE object the preallocation size must match the SEQUENCE objects "increment by".

See Also:
  • Field Details

    • shouldUseIdentityIfPlatformSupports

      protected boolean shouldUseIdentityIfPlatformSupports
      true indicates that identity should be used - if the platform supports identity. false indicates that sequence objects should be used - if the platform supports sequence objects.
    • shouldUseGeneratedKeysIfPlatformSupports

      protected boolean shouldUseGeneratedKeysIfPlatformSupports
      true indicates that identity is used and generatedKeys should be used - if the platform supports generatedKeys false indicates that identity is used and generatedKeys should not be used - if the platform does not support generatedKeys
    • delegateSequence

      protected QuerySequence delegateSequence
      Allow sequencing to be delegated to another sequence if native sequencing is not supported.
  • Constructor Details

    • NativeSequence

      public NativeSequence()
    • NativeSequence

      public NativeSequence(boolean shouldUseIdentityIfPlatformSupports)
    • NativeSequence

      public NativeSequence(String name)
      Create a new sequence with the name.
    • NativeSequence

      public NativeSequence(String name, boolean shouldUseIdentityIfPlatformSupports)
    • NativeSequence

      public NativeSequence(String name, int size)
      Create a new sequence with the name and sequence pre-allocation size.
    • NativeSequence

      public NativeSequence(String name, int size, boolean shouldUseIdentityIfPlatformSupports)
    • NativeSequence

      public NativeSequence(String name, int size, int initialValue)
    • NativeSequence

      public NativeSequence(String name, int size, int initialValue, boolean shouldUseIdentityIfPlatformSupports)
  • Method Details

    • isNative

      public boolean isNative()
      Overrides:
      isNative in class Sequence
    • setShouldUseIdentityIfPlatformSupports

      public void setShouldUseIdentityIfPlatformSupports(boolean shouldUseIdentityIfPlatformSupports)
    • shouldUseIdentityIfPlatformSupports

      public boolean shouldUseIdentityIfPlatformSupports()
    • setShouldUseGeneratedKeysIfPlatformSupports

      public void setShouldUseGeneratedKeysIfPlatformSupports(boolean shouldUseGeneratedKeysIfPlatformSupports)
    • shouldUseGeneratedKeysIfPlatformSupports

      public boolean shouldUseGeneratedKeysIfPlatformSupports()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class QuerySequence
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class QuerySequence
    • buildSelectQuery

      protected ValueReadQuery buildSelectQuery()
      INTERNAL:
      Overrides:
      buildSelectQuery in class QuerySequence
    • buildSelectQuery

      protected ValueReadQuery buildSelectQuery(String seqName, Integer size)
      INTERNAL:
      Overrides:
      buildSelectQuery in class QuerySequence
    • hasDelegateSequence

      public boolean hasDelegateSequence()
      Return if the sequence should be replaced by another sequence implementation. This is used when the platform does not support the native sequence type.
    • getDelegateSequence

      public QuerySequence getDelegateSequence()
      Return the sequence delegate. This is used when the platform does not support the native sequence type.
    • setDelegateSequence

      public void setDelegateSequence(QuerySequence delegateSequence)
      Set the sequence delegate. This is used when the platform does not support the native sequence type.
    • onConnect

      public void onConnect()
      INTERNAL:
      Overrides:
      onConnect in class QuerySequence
    • onDisconnect

      public void onDisconnect()
      INTERNAL:
      Overrides:
      onDisconnect in class QuerySequence