Primary Keys for Container-Managed Persistence
Sometimes you must implement the class and package it along with the entity bean. For example, if your entity bean requires a composite primary key (which is made up of multiple fields) or if a primary key field is a Java programming language primitive type, then you must provide a customized primary key class.
The Primary Key Class
For container-managed persistence, a primary key class must meet the following requirements:
The access control modifier of the class must be public.
All fields must be declared as public.
The fields must be a subset of the bean's persistent fields.
The class must have a public default constructor.
The class must implement the hashCode() and equals(Object other) methods. ...
Get The J2EE™ Tutorial Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.