Annotation Interface MapKeyClass


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface MapKeyClass
Specifies the type of the map key for associations of type Map. The map key can be a basic type, an embeddable class, or an entity. If the map is specified using Java generics, the MapKeyClass annotation and associated type need not be specified; otherwise they must be specified.

The MapKeyClass annotation is used in conjunction with ElementCollection or one of the collection-valued relationship annotations (OneToMany or ManyToMany). The MapKey annotation is not used when MapKeyClass is specified and vice versa.

Example 1:

Example 2:

Example 3:

Example 4:

Since:
2.0
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    (Required) The type of the map key.
  • Element Details

    • value

      Class<?> value
      (Required) The type of the map key.