2.7.16 @Enumerated

Organization of this subsection
(1) Description
(2) Element

(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:

The applicable targets are method and field.

(2) Element

The following table lists the elements of @Enumerated:

Element nameOptional/RequiredElement description
valueOptionalThis 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