Hi! Basically you need a custom Primary Key class when you have specified a composite primary key(i.e when a combination of more than one field in a table is used as a primary key) for a table in the database. for further reference see:- Book Name:-Sams teach yourself J2EE in 21 days chapter 6-Entity EJB's Page 205. Topic: Custom Primary Key Classes
Not sure, that this class is required. Wizards generate primary key class but as far as I know usage of primary key is recomented by not mandatory.
This is quote
In the EJB 1.1 specification, primary keys have been... Shaun Childers, Jul 6, 2000 In the EJB 1.1 specification, primary keys have been defined as either simple or compound keys. Simple keys use a single field in the underlying datastore as a primary key, while compound keys use multiple fields. For simple primary keys, you don't need to wrap the field in a primary key class. This type of simple key is defined in the ejb-jar.xml deployment descriptor file:
<entity> ... <prim-key-class>java.lang.String</prim-key-class> ... <primkey-field>userName</primkey-field> ... For primary keys which map to primitive types, like int, the specification requires a primary key wrapper class. You can define these primay key types as compound primary keys. Note: Compound primary keys are used for multiple primary key fields as well as single primary key fields of primitive types. With compound primary keys, the EJB bean developer still has to define the primary key class. Compound primary keys are defined in the ejb-jar.xml file as follows: