Suren,
The serialVersionUID allows you to explicitly specify the value of something called a stream unique identifier (SUID) that's normally calculated by Java's serialization mechanism. You're never required to define the serialVersionUID field, but you may find it useful sometimes. The SUID value (either one you explicitly define or one that's calculated at run time) of a class is included with the stream of bytes that's written when you serialize / marshall an instance of that class. Then, when that byte stream is being deserialized / unmarshalled, the SUID value in the byte stream is compared with the one for the local class definition to make sure that the two are identical and therefore, compatible.
I can't provide you with more information on how and when to use serialVersionUID without writing a very long response. However, if I haven't fully answered your questions (or even if I have
), I'd encourage you to consider picking up a copy of my book. It includes a chapter on data persistence where I discuss serialization in general and SUIDs in particular in much greater detail.
------------------
Brett Spell
Author,
Professional Java Programming