Defining Primary Identifier Mappings

Primary identifier mapping is mandatory in Hibernate. Primary identifiers of classes are mapped to primary keys of master tables in data sources. If not defined, a default primary identifier mapping will be generated, but this may not work properly.

There are three kinds of primary identifier mapping in Hibernate:

Mapped classes must declare the primary key column of the database table. Most classes will also have a Java-Beans-style property holding the unique identifier of an instance.