In bean-managed persistence, a primary key can be a serializable object
defined specifically for the bean by the bean developer. The primary
key defines attributes we can use to locate a specific bean in the
database. For the ShipBean
we need only one
attribute, id
, but in other cases a primary key
may have several attributes, which together uniquely identify a
bean’s data.
We will examine primary keys in detail in Chapter 11; for now, we specify that the Ship EJB uses a
simple single-value primary key of type
java.lang.Integer
. The actual persistence field in
the bean class is an Integer
named
id
.