Annotation Interface TableGenerator


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

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.TABLE)
     @TableGenerator(pkColumnValue = "EMPLOYEE_ID")
     Integer id;

     ...
 }
 
  • Element Details

    • pkColumnValue

      String pkColumnValue
      Returns:
      the value to be used as the primary key in the generator table to identify this generator.
    • catalog

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

      String schema
      Returns:
      the schema name for the generator table.
      Default:
      ""
    • table

      String table
      Returns:
      the name of the table used for ID generation.
      Default:
      "ID_GENERATOR"
    • pkColumnName

      String pkColumnName
      Returns:
      the name of the column that serves as the primary key in the generator table.
      Default:
      "PK"
    • valueColumnName

      String valueColumnName
      Returns:
      the name of the column that stores the generated identifier values.
      Default:
      "VALUE"
    • initialValue

      long initialValue
      Returns:
      the initial value for the sequence counter in the generator table.
      Default:
      1L
    • allocationSize

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

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