Here's a Compound Primary Key Class using the @Embeddable tag:
(From this Hibernate/JPA Tutorial)
Later, a class can use that compound key:
ith the @IdClass annotation, you don't declare an instance variable of type CompoundKey, but instead, just define instance variables for each of the primary key fields. You then mark the corresponding getter tags with standard @Id annotations.
Here's a little bit more detailed explaination about mapping compound primary keys with Hibernate and JPA:
Mapping Composite Keys with the Java Persistence API (JPA)
-Cameron McKenzie