Annotation Interface GeneratedValue


@Target(FIELD) @Retention(RUNTIME) public @interface GeneratedValue
Indicates a strategy to generate identifiers.

The annotated field must be a member of an Entity annotated class and the field must be annotated with Id.

The additional annotation is required according to the strategy value:

 @Entity
 public class Employee {

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

     ...
 }
 
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Element Details

    • strategy

      GenerationType strategy
      Returns:
      the strategy for generating identifiers.