provided by: 
Originally published at Internet.comAs you know, Enterprise Java Beans (EJB) technology provides a format for highly specialized business logic components, wherein the EJB is just a collection of java classes and XML files, bundled into a single unit. The Java classes must follow certain rules and provide certain callback methods. Of the various types of the EJB, the most commonly used one is the Entity Bean, which always represents the shared, transactional data in your application. The persistence of an Entity Bean can be managed by the Bean Programmer (BMP) or by the container itself (CMP). As I mentioned above, certain Java classes are to be implemented along with the certain rules for the Entity Bean for any CMP or BMP. One of these is the Primary Key class. I am going to talk about this class.
Why Primary Key Class
Every Entity Bean has a primary key that represents a unique identity and must be represented by a class known as primary key class. This class must contain the information necessary to find that entity in the persistent store. It is used internally by the EJB container or client to find a particular instance of the entity. Hence, this class must follow certain rules.
1. It must have a unique value within the set of all beans of a particular type. 2. It must provide suitable implementation of hashCode() and equals() methods. 3. It must be serializable...
Read article at Internet.com site