• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serial version ID for the serialized objects in DB

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have few serialized objects in a table in SQL server whose data type is Image. Could some one let me know how to know the serial version ID of this? We have to verify all these objects in all environments and since we are migrating it to java 1.6, we need to make sure they are consistent across all environments.

Thanks,
 
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Uhhh isn't the serialVersionUID automatically checked when you deserialize the object?
 
Master Rancher
Posts: 4806
72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, at first glance it would seem the easiest way to do this is to simply try to deserialize some of these objects using Java 6 and see if it works. If the serialVersionUid is wrong, you will get a clear error message. If there are a lot of these objects and you can't test them all, then at least try testing as many of them as you can, using a random sample.

What sort of Image is this, really? I assume it's not a java.awt.Image, since those are not serializable. In general I'm suspicious of the idea of using serialization for image data - I would recommend using java.awt.ImageIO and its read() and write() methods to do this. But it sounds like you may be stuck with existing data that was written a certain way, OK. If you are using Java serialization, what exact class or classes are the serialized objects from? And, is it a class that has changed implementation at all in JDK 6? Is it a class under your control, or a library class of some sort?
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic