Annotation Interface SequenceGenerator


@Target(FIELD) @Retention(RUNTIME) public @interface SequenceGenerator
Indicates an identifier generator that uses a sequence.

The annotated field must be a member of an Entity annotated class. This annotation must be used in conjunction with the Id annotation and the GeneratedValue annotation.

 @Entity
 public class Employee {

     @Id
     @GeneratedValue(strategy = GenerationType.SEQUENCE)
     @SequenceGenerator(sequence = "EMPLOYEE_SEQ")
     Integer id;

     ...
 }
 
  • Element Details

    • sequence

      String sequence
      Returns:
      the name of the database sequence to use for generating identifiers.
    • catalog

      String catalog
      Returns:
      the catalog name for the sequence.
      Default:
      ""
    • schema

      String schema
      Returns:
      the schema name for the sequence.
      Default:
      ""
    • initialValue

      long initialValue
      Returns:
      the initial value for the sequence.
      Default:
      1L
    • allocationSize

      long allocationSize
      Returns:
      the allocation size for the sequence, which determines how many values are fetched at once.
      Default:
      1L
    • implementer

      Class<? extends SequenceIdGenerator> implementer
      Returns:
      the implementation class of the SequenceIdGenerator interface.
      Default:
      org.seasar.doma.jdbc.id.BuiltinSequenceIdGenerator.class