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:
- the
SequenceGeneratorannotation is required, ifGenerationType.SEQUENCEis specified. - the
TableGeneratorannotation is required, ifGenerationType.TABLEis specified.
@Entity
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@SequenceGenerator(sequence = "EMPLOYEE_SEQ")
Integer id;
...
}
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
strategy
GenerationType strategy- Returns:
- the strategy for generating identifiers.
-