3.8.7.8.1. Key Columns

Key columns serve the same role for map keys as the element join columns described in 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 Column in the JPA Overview for a review of the Column annotation.