8.12.16 @Enumerated
- Organization of this subsection
(1) Description
This annotation specifies the persistence field or persistence property as the enumeration type.
This annotation can be used along with @Basic. You can specify ORDINAL (numeric type) and STRING (character string type) in the enumeration type.
In the following cases, ORDINAL (numeric type) is specified as the enumeration type:
-
When the enumeration type is not specified in the value element
-
When @Enumerated is not specified
The applicable targets are method and field.
(2) Element
The following table lists the elements of @Enumerated:
Element name |
Optional/Required |
Element description |
---|---|---|
Optional |
This element specifies the type used for mapping the enumeration type. |
The details of attributes that are supported with Cosminexus JPA provider are as follows:
(a) value element
- Type
-
EnumType
- Description
-
This element specifies the type used for mapping the enumeration type.
You can specify either of the following values:
-
EnumType.ORDINAL: Numeric type
-
EnumType.STRING: Character string type
-
- Default value
-
EnumType.ORDINAL