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

Public Instance Methods

(Optional) Used to specify or control the generation of a foreign key constraint when table generation is in effect.
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.
Since:
Jakarta Persistence (JPA) 2.1
The join columns that map the relationship.
Since:
Jakarta Persistence (JPA) 1.0

Annotation Elements

This is a marker annotation with no members/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()