EclipseLink 2.0.0_ 2.0.0.v20090626-r4569 API Reference

javax.persistence
Annotation Type MapKeyEnumerated


@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface MapKeyEnumerated

Specifies that a persistent map key should be persisted as a 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.

   Example:

   public enum ProjectStatus {COMPLETE, DELAYED, CANCELLED, IN_PROGRESS}

   public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}

   @Entity public class Employee {
       @ManyToMany
       public Projects getProjects() {...}
       
       @OneToMany
       @Enumerated(STRING)
       public Map getEmployees() {...}
       ...
   }
 

Since:
Java Persistence 2.0

Optional Element Summary
 EnumType value
          (Optional) The type used in mapping a map key enum type.
 

value

public abstract EnumType value
(Optional) The type used in mapping a map key enum type.

Default:
javax.persistence.EnumType.ORDINAL

EclipseLink 2.0.0_ 2.0.0.v20090626-r4569 API Reference