Jakarta Persistence (JPA) Annotation Type
jakarta.persistence.JoinColumns
- Implemented Interfaces:
Annotation
- Target:
- Method, Field
Specifies the mapping for composite foreign keys. This annotation groups
JoinColumn annotations for the same relationship. Each JoinColumn annotation must explicit specify both name and referencedColumnName.
Example:
@ManyToOne @JoinColumns({ @JoinColumn(name = "ADDR_ID", referencedColumnName = "ID"), @JoinColumn(name = "ADDR_ZIP", referencedColumnName = "ZIP")}) public Address getAddress() { return address; }
- See Also:
- Since:
- Jakarta Persistence (JPA) 1.0
Public Static Fields
No JavaDoc Info for jakarta.persistence.JoinColumns/class
Annotation Elements
- Since:
- Jakarta Persistence (JPA) 1.0
If both this element and the
foreignKey element of any of the JoinColumn 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(PROVIDER_DEFAULT)
- Since:
- Jakarta Persistence (JPA) 2.1
Additional JDK methods inherited from java.lang.annotation.Annotation
annotationType(), equals(Object), hashCode(), toString()