Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

serialization -- Good Bad Do it anyway?

 
Dwayne Barsotta
Ranch Hand
Posts: 71
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse keeps giving me a "The serializable class RepairOrder does not detect a static final serialVersionID field of type long" suggestion.  I read serialization can be used when adding the object to a XML or byte[] stream for saving in a database.  Other then this can someone explain this in laymans terms, as in what's it important for?  Should I do this for all the classes that it suggests?  What are some of the common reasons for this?

If I set the value in the class as "static final" this means that every object of that class would contain that number.  Correct?  So is it a form of grouping all the objects of a single class?

I searched it a little but the results were endless, partially or not related at all or technical.

I have to say, when I was learning VB6.0 most of the books, tutorials videos ext actually explained what something was before how to use it!  I wish Java followed that!!


Any way whats the "For Dummies" idea behind "static final serialVersionID"

Thanks again!!!
 
Suraj Jadhav
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Dwayne,

Hope this http://javarevisited.blogspot.com/2014/05/why-use-serialversionuid-inside-serializable-class-in-java.html will resolve your queries.
 
Campbell Ritchie
Marshal
Posts: 53094
124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am afraid it doesn't That article gets off to a good start but doesn't explain things well, doesn't explain the customised binary format, doesn't explain what a default SUID would mean, or what happens if you simply guess the SUID.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!