Monday, July 2, 2012

Hibernate: Composite Primary Key Mapping

Here's how to do it:

<composite-id name="id" class="com.xxx.xxx.xxx.KeyClass">
       <key-property name="keyProp1" column="key1" />
       <key-property name="keyProp2" column="key2" />
</composite-id>

Use this in place of the usual "id" tag.

No comments:

Post a Comment