The Java EE 6 Tutorial, Volume I

One-to-One Relationships

Part has a field, vendorPart, that has a one-to-one relationship with VendorPart’s part field. That is, each part has exactly one vendor part, and vice versa.

Here is the relationship mapping in Part:

public VendorPart getVendorPart() {
    return vendorPart;

Here is the relationship mapping in VendorPart:

public Part getPart() {
    return part;

Note that, because Part uses a compound primary key, the @JoinColumns annotation is used to map the columns in the PERSISTENCE_ORDER_VENDOR_PART table to the columns in PERSISTENCE_ORDER_PART. PERSISTENCE_ORDER_VENDOR_PART’s PARTREVISION column refers to PERSISTENCE_ORDER_PART’s REVISION column.