One can assign a primary key for its class by using @Id annotation in JPA. My question is what if one doesn't want to have an auto generated key in his tables and use fields (maybe more than one) as a primary key.
Let's say we have a person table with SSN, NATIONALITY and NAME. SSN is defined as the number a person is identified by in his country. Thus, we might have two persons with the same number in two different countries. The primary key for this table can be SSN+NATIONALITY. Is there any way to map these two fields using JPA and map it to an object? or the only way it to create an auto generated id and use @Id annotation
CREATE TABLE PERSON (
SSN INT,
NATIONALITY VARCHAR,
NAME VARCHAR
)