8. Key Columns

Key columns serve the same role for map keys as the element join columns described in Section 7.6.2, “ Element Join Columns ” serve for collection elements. OpenJPA's org.apache.openjpa.persistence.jdbc.KeyColumn annotation represents a map key. To map custom multi-column keys, use the org.apache.openjpa.persistence.jdbc.KeyColumns annotation, whose value is an array of KeyColumns.

A KeyColumn always resides in a container table, so it does not have the table property of a standard Column. Otherwise, the KeyColumn and standard Column annotations are equivalent. See Section 3, “ Column ” in the JPA Overview for a review of the Column annotation.