Chapter 2. Basic Mapping and Object Identity

A primary key in a database table is used to uniquely identify a record in that table. The primary key value can't be null and is unique within a table. The primary key is also used to establish a relationship between two tables—it's defined as a foreign key in the associated table. Because the primary key is used to identify a particular record, it can also be called the database identifier. The database identifier is exposed to the application by Hibernate through an identifier property of the persistent entity. This chapter discusses the various ways to generate an identifier (primary key) for a database record. You learn about metadata configurations and their effect on the persistence mechanism. ...

Get Hibernate Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.