9. Key Join Columns

Key join columns are equivalent to standard JPA join columns, except that they represent a join to a map key entity rather than a direct relation. You represent a key join column with OpenJPA's org.apache.openjpa.persistence.jdbc.KeyJoinColumn annotation. To declare a compound join, enclose an array of KeyJoinColumns in the org.apache.openjpa.persistence.jdbc.KeyJoinColumns annotation.

A KeyJoinColumn always resides in a container table, so it does not have the table property of a standard JoinColumn. Like XJoinColumns above, KeyJoinColumns can reference a linked field rather than a static linked column. Otherwise, the KeyJoinColumn and standard JoinColumn annotations are equivalent. See Section 8.4, “ Direct Relations ” in the JPA Overview for a review of the JoinColumn annotation.