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
Annotation Elements
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".
- Default:
- ""
- Since:
- Jakarta Persistence (JPA) 1.0
boolean uniqueUniqueConstraint 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.- Default:
- false
- Since:
- Jakarta Persistence (JPA) 1.0
boolean nullable- Default:
- false
- Since:
- Jakarta Persistence (JPA) 1.0
boolean insertable- Default:
- true
- Since:
- Jakarta Persistence (JPA) 1.0
boolean updatable- Default:
- true
- Since:
- Jakarta Persistence (JPA) 1.0
String columnDefinitionDefaults to the generated SQL to create a column of the inferred type.
- Default:
- ""
- Since:
- Jakarta Persistence (JPA) 1.0
String optionsString 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.
- Default:
- ""
- Since:
- Jakarta Persistence (JPA) 1.0
int length Applies only to columns whose type is parameterized by length, for example, varchar or varbinary types.
- Default:
- 255
- Since:
- Jakarta Persistence (JPA) 1.0
int precisionApplies only to columns of exact numeric type.
The default value 0 indicates that a provider-determined precision should be inferred.
- Default:
- 0
- Since:
- Jakarta Persistence (JPA) 1.0
int scaleApplies only to columns of exact numeric type.
The default value 0 indicates that a provider-determined precision should be inferred.
- Default:
- 0
- Since:
- Jakarta Persistence (JPA) 1.0
Additional JDK methods inherited from java.lang.annotation.Annotation
annotationType(), equals(Object), hashCode(), toString()