Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate @MapKey(name=..) and replace with @MapKey(..) #685

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "";
}