• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using serialVersionUID ...  RSS feed

 
Md. Mohd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenver we have to implement the Seriazable interface we have to define a private member of "long" type for interoperateablity. This member is "serialVersionUID" .
What is the criteria to set this final member , I mean what value we have to set for this ?
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It needs to be a long. You can make one up. Incompatible versions of the same class should have different values. If you make a change to a class that would alter the way it would be serialized [i.e., add a field], you should change the UID.

If you need to find the uid of an existing class you can use the java utility serialver. The command is:

serialver [-classpath classpath] [-show] [classname...]
[ December 27, 2006: Message edited by: Scott Johnson ]
 
Md. Mohd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Scott Johnson
Thanks for valuable feedback.Also go for the link http://www-03.ibm.com/developerworks/blogs/page/woolf?entry=serialization_and_serial_version_uid

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!