Skip to content

Commit

Permalink
deprecate @mapkey(name=..) and replace with @mapkey(..)
Browse files Browse the repository at this point in the history
see jakartaee#684

Signed-off-by: Gavin King <[email protected]>
  • Loading branch information
gavinking committed Nov 11, 2024
1 parent 1aac75c commit 56a6c98
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion api/src/main/java/jakarta/persistence/MapKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* public class Department {
* ...
* @OneToMany(mappedBy = "department")
* @MapKey(name = "name")
* @MapKey("name")
* public Map<String, Employee> getEmployees() {... }
* ...
* }
Expand Down Expand Up @@ -95,5 +95,19 @@
* mapped as {@link IdClass}, an instance of the primary key
* class is used as the key.
*/
String value() default "";

/**
* (Optional) The name of the persistent field or property of
* the associated entity that is used as the map key.
* <p> Default: If the {@code name} element is not specified,
* the primary key of the associated entity is used as the map
* key. If the primary key is a composite primary key and is
* mapped as {@link IdClass}, an instance of the primary key
* class is used as the key.
*
* @deprecated Use {@link #value} instead
*/
@Deprecated(since = "4.0")
String name() default "";
}

0 comments on commit 56a6c98

Please sign in to comment.