Annotation Interface JoinColumn


@Repeatable(JoinColumns.class) @Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface JoinColumn
Specifies a column for joining an entity association or element collection. If the JoinColumn annotation itself is defaulted, a single join column is assumed and the default values apply.

Example:

@ManyToOne
@JoinColumn(name = "ADDR_ID")
public Address getAddress() { return address; }

Example: unidirectional one-to-many association using a foreign key mapping

// In Customer class
@OneToMany
@JoinColumn(name = "CUST_ID") // join column is in the table for Order
public Set<Order> getOrders() { return orders; }
Since:
1.0
See Also: