Jakarta Persistence (JPA) Annotation Type
jakarta.persistence.EnumeratedValue
- Implemented Interfaces:
Annotation
- Target:
- Field
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: byte,short, orintforEnumType.ORDINAL, orStringforEnumType.STRING.
Example:
enum Status { OPEN(0), CLOSED(1), CANCELLED(-1); @EnumeratedValue final int intValue; Status(int intValue) { this.intValue = intValue; } }
- See Also:
- Since:
- Jakarta Persistence (JPA) 3.2
Annotation Elements
This is a marker annotation with no members/elements.
Additional JDK methods inherited from java.lang.annotation.Annotation
annotationType(), equals(Object), hashCode(), toString()