Advertisement

Basic Mapping and Object Identity

  • Joseph Ottinger
  • Srinivas Guruzu
  • Gary Mak
Chapter

Abstract

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 is 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, which 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.

Copyright information

© Joseph Ottinger 2015

Authors and Affiliations

  • Joseph Ottinger
    • 1
  • Srinivas Guruzu
    • 1
  • Gary Mak
    • 1
  1. 1.NCUnited States

Personalised recommendations