Can some one justify why Sun EJB Specificiation mandates the usage of Java objects which are serializable to be the primary key for an Entity Bean instead of primitives which are serializable,perhaps by default.
Primitives are not serializable on their own. Yes, they get serialized/deserialized automatically, with the object they are used in. So for PK implementation we have to have an object which can be serialized. Hope this helps...
No this does not help me! Why the primary key has to be serializable? Why it cannot be e.g. integer like other integer persistant fields?
Because the PK must be able to 'exist' outside the object. When you use a finder method on the Home interface, you pass in a PK object. Note that this PK object exists before the 'real' object does, and since the object can get transferred over the wire or stored temporarily (what and how exactly depends upon the container implementation) it must be serializable.