jakarta.persistence.MapKeyColumn
- Implemented Interfaces:
Annotation
- Target:
- Method, Field
name element is not specified, it defaults to the concatenation of the following: the name of the referencing relationship field or property; "_"; "KEY". Example:
@Entity public class Item { @Id int id; ... @ElementCollection @MapKeyColumn(name = "IMAGE_NAME") @Column(name = "IMAGE_FILENAME") @CollectionTable(name = "IMAGE_MAPPING") Map images; // map from image name to filename ... }
- Since:
- Jakarta Persistence (JPA) 2.0
Public Instance Methods
String columnDefinition()Defaults to the generated SQL to create a column of the inferred type.
- Since:
- Jakarta Persistence (JPA) 1.0
boolean insertable()- Since:
- Jakarta Persistence (JPA) 1.0
int length() Applies only to columns whose type is parameterized by length, for example, varchar or varbinary types.
- Since:
- Jakarta Persistence (JPA) 1.0
String name()- If the map key is for an element collection, the map key column is in the collection table for the map value.
- If the map key is for a
ManyToManyentity relationship or for aOneToManyentity relationship using a join table, the map key column is in a join table. - If the map key is for a
OneToManyentity relationship using a foreign key mapping strategy, the map key column is in the table of the entity that is the value of the map.
Defaults to the concatenation of the following: the name of the referencing relationship field or property; "_"; "KEY".
- Since:
- Jakarta Persistence (JPA) 1.0
boolean nullable()- Since:
- Jakarta Persistence (JPA) 1.0
String options()columnDefinition.- Since:
- Jakarta Persistence (JPA) 3.2
int precision()Applies only to columns of exact numeric type.
The default value 0 indicates that a provider-determined precision should be inferred.
- Since:
- Jakarta Persistence (JPA) 1.0
int scale()Applies only to columns of exact numeric type.
The default value 0 indicates that a provider-determined precision should be inferred.
- Since:
- Jakarta Persistence (JPA) 1.0
String table() Defaults: If the map key is for an element collection, the name of the collection table for the map value. If the map key is for a OneToMany or ManyToMany entity relationship using a join table, the name of the join table for the map. If the map key is for a OneToMany entity relationship using a foreign key mapping strategy, the name of the primary table of the entity that is the value of the map.
- Since:
- Jakarta Persistence (JPA) 1.0
boolean unique()UniqueConstraint annotation at the table level and is useful for when the unique key constraint corresponds to only a single column. This constraint applies in addition to any constraint entailed by primary key mapping and to constraints specified at the table level.- Since:
- Jakarta Persistence (JPA) 1.0
boolean updatable()- Since:
- Jakarta Persistence (JPA) 1.0
Annotation Elements
Additional JDK methods inherited from java.lang.annotation.Annotation
java.lang.annotation.Annotation/annotationType(), java.lang.annotation.Annotation/equals(Object), java.lang.annotation.Annotation/hashCode(), java.lang.annotation.Annotation/toString()