Solved

Entity bean's primary key class must implement Serializable?

Posted on 2004-08-07
7
774 Views
Last Modified: 2013-11-24
why Entity bean's primary key class must implement Serializable?

what Serializable is used for?
0
Comment
Question by:she1
7 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 25 total points
ID: 11745874
It is used to transfer objects across the wire and to save the satte of the object on the disk.
0
 
LVL 5

Assisted Solution

by:mrigank
mrigank earned 25 total points
ID: 11750356
And your EntityBean might be deployed remotely ... You need to pass the Primary Key for a finder , The bean passes the PK object back in the ejbCreate ... this is done across the wire .. so the PK should implement Serializable ....
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 11750417
Anything that goes across a network should be serialize-able:

http://mindprod.com/jgloss/serialization.html
0
 
LVL 5

Expert Comment

by:mrigank
ID: 11750447
During pooling of bean instances, if the maximum pool size is exceeded, then the container saves some of the beans onto the disk to allow for new instances. Now when a bean which has been saved onto the disk is called for, the container reconstructs the bean from the secondary storage. To do this it might also need to persist an existing bean which is not being used.
The persistance of beans requires all bean and bean related objects to implement serializable.
0
 

Author Comment

by:she1
ID: 12012861
so the 2 reasons for serizable: remote deployment, & persist the  bean to secondary storage.

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now