Annotation Interface GeneratedValue


@Retention(RUNTIME) @Target(FIELD) public @interface GeneratedValue
Marks a field as being generated by the database upon insertion. This annotation is typically applied to a field within a Java class that represents an entity in a data store. It allows the specification of a generation strategy for the annotated field, indicating how the database generates the values for this field.

The default generation strategy is GenerationType.IDENTITY.

Since:
1.0
Author:
Blyzhnytsia Team
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the name of the generator to use (if applicable).
    Specifies the generation strategy for the annotated field.
  • Element Details

    • strategy

      GenerationType strategy
      Specifies the generation strategy for the annotated field. The default is GenerationType.IDENTITY.
      Returns:
      The generation strategy for the annotated field.
      Default:
      IDENTITY
    • generator

      String generator
      Specifies the name of the generator to use (if applicable). The default is an empty string.
      Returns:
      The name of the generator.
      Default:
      ""