JPA EmbeddableId annotation

The EmbeddableId annotation is used to create a composite primary key. It can also be applied to a persistent field or property of an entity class or mapped superclass to denote a composite primary key that is an embeddable class.

Example:

@Embeddable public class Zipcode {
       protected String zip;
       protected String plusFour;
}
 
@Embeddable public class Address {
       protected String street;
       protected String city;
       protected String state;
       @EmbeddedId protected Zipcode zipcode;
}