Annotation Type MapKeyEnumerated

public @interface MapKeyEnumerated

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.


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

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

   @Entity public class Employee {
       public Projects<ProjectStatus, Project> getProjects() {...}
       public Map<SalaryRate, Employee> getEmployees() {...}

Java Persistence 2.0
See Also:
ElementCollection, OneToMany, ManyToMany

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


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


Submit a bug or feature

Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 10-February-2011 12:41

Scripting on this page tracks web page traffic, but does not change the content in any way.