it is very simple for hibernate . There is a solution about the composit-id
you can read the document about hibernate composite-id.
i reference a bit from the hibernate document :
Quote:
For a table with a composite key, you may map multiple properties of the class as identifier properties. The
<composite-id> element accepts <key-property> property mappings and <key-many-to-one> mappings as
child elements.
<composite-id>
<key-property name="medicareNumber"/>
<key-property name="dependent"/>
</composite-id>
Your persistent class must override equals() and hashCode() to implement composite identifier equality. It
must also implements Serializable.