Hi,

Serialization is used to save an object's state as a sequence of bytes (In
clustered web applications this is crucial for failover of the HttpSession
to another server in the cluster).

I think this article explains it all fairly well, even if it is a little
old:

http://java.sun.com/developer/technicalArticles/Programming/serialization/

The article below discusses some ways of using Serialization judiciously
(mainly with respect to WebSphere, but it has some good ideas):

http://www-128.ibm.com/developerworks/websphere/library/bestpractices/httpsession_performance_serialization.html

serialVersionUID:

You don't have to explicitly define a serialVersionUID (although I'd
reccommend you do - see below), but if you don't then any changes to your
class will result in the class being incompatible with previously serialized
versions of the object.

If you define a serialVersionUID, then class compatibility is assumed. You
should only ever need to change the serialVersionUID if changes to your
class will make it incompatible. These are discussed in the first linked
article:

"Compatible changes include adding or removing a method or a field.
Incompatible changes include changing an object's hierarchy or removing the
implementation of the Serializable interface. A complete list of compatible
and incompatible changes is given in the Java Serialization Specification."

Hope that's some help!

Cheers,

Pete


On 2/20/07, sionsmith <[EMAIL PROTECTED]> wrote:


hi all, i'm not new to Java or Jsf but i am a little confused about when i
should be implementing java.io.Serializable

Throughout the appfuse project Matt implements Serializable and i cant
figure out why, i've never used this method before, i gather any class
which
implements it has to have a serialVersionUID... how does this make the
object / Bean different... i dont get it?

Any info or links where this is explained clearly would be very greatful
:)

thanks Sion
--
View this message in context:
http://www.nabble.com/When-to-use-java.io.Serializable-tf3257850s2369.html#a9057324
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to