Annotation Interface SequenceGenerator


@Target({TYPE,METHOD,FIELD}) @Retention(RUNTIME) public @interface SequenceGenerator
Specifies a sequence generator for generating values for annotated fields marked with GeneratedValue using the GenerationType.SEQUENCE strategy. This annotation is typically applied to a field, method, or class within a Java class that represents an entity in a data store.

The name attribute defines the name of the generator, while the sequenceName attribute specifies the name of the database sequence to be used. The initialValue and allocationSize attributes allow customization of the initial value and the increment size of the sequence, respectively.

Since:
1.0
Author:
Blyzhnytsia Team
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the name of the sequence generator.
    Specifies the name of the database sequence to be used.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    Specifies the size of the allocation block for the sequence.
    int
    Specifies the initial value for the sequence.
  • Element Details

    • name

      String name
      Specifies the name of the sequence generator.
      Returns:
      The name of the sequence generator.
    • sequenceName

      String sequenceName
      Specifies the name of the database sequence to be used.
      Returns:
      The name of the database sequence.
    • initialValue

      int initialValue
      Specifies the initial value for the sequence. The default is 1.
      Returns:
      The initial value for the sequence.
      Default:
      1
    • allocationSize

      int allocationSize
      Specifies the size of the allocation block for the sequence. The default is 50.
      Returns:
      The allocation size for the sequence.
      Default:
      50