Top Description Methods
jakarta.persistence

public @Interface EnumeratedValue

extends Annotation
Annotations
@Target:FIELD
@Retention:RUNTIME
Imports
java.lang.annotation.Retention, .Target

Specifies that an annotated field of a Java enum type is the source of database column values for an enumerated mapping. The annotated field must be declared final, and must be of type: The annotated field must not be null, and must hold a distinct value for each value of the enum type.

Example:

enum Status { OPEN(0), CLOSED(1), CANCELLED(-1); @EnumeratedValue final int intValue; Status(int intValue) { this.intValue = intValue; } }
enum Status {
    OPEN(0), CLOSED(1), CANCELLED(-1);

    @EnumeratedValue
    final int intValue;

    Status(int intValue) {
        this.intValue = intValue;
    }
}
Since
3.2
See Also
Enumerated, EnumType

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString