Jakarta Persistence (JPA) Annotation Type
jakarta.persistence.PrimaryKeyJoinColumns
- Implemented Interfaces:
Annotation
- Target:
- Type, Method, Field
Groups
PrimaryKeyJoinColumn annotations. It is used to map composite foreign keys. Example: ValuedCustomer subclass
@Entity @Table(name = "VCUST") @DiscriminatorValue("VCUST") @PrimaryKeyJoinColumns({ @PrimaryKeyJoinColumn(name = "CUST_ID", referencedColumnName = "ID"), @PrimaryKeyJoinColumn(name = "CUST_TYPE", referencedColumnName = "TYPE")}) public class ValuedCustomer extends Customer { ... }
- See Also:
- Since:
- Jakarta Persistence (JPA) 1.0
Annotation Elements
- Since:
- Jakarta Persistence (JPA) 1.0
If both this element and the
foreignKey element of any of the PrimaryKeyJoinColumn elements are specified, the behavior is undefined. If no foreign key annotation element is specified in either location, a default foreign key strategy is selected by the persistence provider.- Default:
- @ForeignKey(ConstraintMode.PROVIDER_DEFAULT)
- Since:
- Jakarta Persistence (JPA) 2.1
Additional JDK methods inherited from java.lang.annotation.Annotation
annotationType(), equals(Object), hashCode(), toString()