Columns of primary keys should be mapped to persistent attributes. Like primary keys for tables, you need to set these persistent attributes as primary identifiers of entity classes. The mapped primary keys should be primary keys of primary tables.
There are three types of primary identifier mapping:
Simple primary identifier mapping which means a primary key with only one column. The mapped primary identifier just has one persistent attribute mapped to the column.
Composite primary identifier mapping which means a primary key is comprised of more than one column. The mapped primary identifier can have the same number of persistent attributes mapped to the columns.
Component primary identifier mapping, which is a special case of composite primary identifier mapping. Multiple persistent attributes are encapsulated into Value type class. The mapped primary identifier contains one attribute whose type is the Value type class.
Primary identifier mapping is mandatory for entity classes.