MapKeyEnumerated
Target: METHOD, FIELD
- Implemented Interfaces:
Annotation
Specifies the enum type for a map key whose basic type is an enumerated type.
The MapKeyEnumerated annotation can be applied to an element collection or relationship of type java.util.Map, in conjunction with the ElementCollection, OneToMany, or ManyToMany annotation. If the enumerated type is not specified or the MapKeyEnumerated annotation is not used, the enumerated type is assumed to be ORDINAL.
Example:
{@snippet :
public enum ProjectStatus {COMPLETE, DELAYED, CANCELLED, IN_PROGRESS}
public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}- See Also:
- ElementCollection
- OneToMany
- ManyToMany
- OneToMany
- Since:
- JPA 2.0