Yes it is possible. A combined primary key consists of several primary key fields. Each primary key field must be one of the supported JPA types. For your table you have:
@Entity @IdClass(PersonId.class) public class Person { @Id int ssn; @Id String nationality; .... }
For an object with multiple keys, the JPA requires the definition of a special identifier class. This class must be attached to the entity class using the @IdClass annotation.
class PersonId { int ssn; String nationality; }
The ID class represents primary key fields, and its objects can represent primary key values
source share