Hi Folks,
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.
Thanks.
Regards
Karthik Banda
-
Why a Primary Key in EJB is a Java Object? (3 messages)
- Posted by: Karthik Banda
- Posted on: July 22 2004 23:13 EDT
Threaded Messages (3)
- Why a Primary Key in EJB is a Java Object? by Vishal Revankar on July 23 2004 02:03 EDT
- Why a Primary Key in EJB is a Java Object? by Stjepan Brbot on July 26 2004 17:02 EDT
- A PK object can stand on its own by Serge Beaumont on July 28 2004 05:28 EDT
- Why a Primary Key in EJB is a Java Object? by Stjepan Brbot on July 26 2004 17:02 EDT
-
Why a Primary Key in EJB is a Java Object?[ Go to top ]
- Posted by: Vishal Revankar
- Posted on: July 23 2004 02:03 EDT
- in response to Karthik Banda
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...
Vishal -
Why a Primary Key in EJB is a Java Object?[ Go to top ]
- Posted by: Stjepan Brbot
- Posted on: July 26 2004 17:02 EDT
- in response to Vishal Revankar
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? -
A PK object can stand on its own[ Go to top ]
- Posted by: Serge Beaumont
- Posted on: July 28 2004 05:28 EDT
- in response to Stjepan Brbot
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.