P
Pixelschubser
Hi there,
I got a really big problem and hope, that anyone of you can help me
out.
Here we go:
I wrote an Java-application which contains a class called "MyClass".
This class has various members, like:
....
int id;
Strinh hersteller;
String farbe;
boolean verkauft;
....
The class also contains getters and setters etc.
Now, if a create a new instance of this class, it will be written as a
serialized object into my database. It works fine, even deserialzation
works.
For better understanding lets call this version of the class "MyClass"
version 1.
Later I made a little change within the class: I only added one more
method (it does't matter what this method does). There nothing else
which is changed in the class.
As is did it before, I create instances of this class and put it as a
serialized object into my database - works fine. Even the
deserialization sems to work.
Lets call this version of the class "MyClass" version 2.
Who knows some things about serialisation of objects, can imagine what
happens now.
Now there are two types of serialiazied objects in my database,
depending on the same class. Because they have different serialUIDs, i
can't now deserialise Objects from version 1 !
My Problem: I need both objects !
Code:
InputStream is = rs.getBlob(1).getBinaryStream();
ObjectInputStream oip = new ObjectInputStream(is);
Object testObject = null;
testObject = oip.readObject(); // Hier fliegt er dann weg !!
Now it is too late, to put the serialUID just as a Long value into the
class. But how can i solve my problem in any way?
Has anyone an idea?
Thx a lot.
I got a really big problem and hope, that anyone of you can help me
out.
Here we go:
I wrote an Java-application which contains a class called "MyClass".
This class has various members, like:
....
int id;
Strinh hersteller;
String farbe;
boolean verkauft;
....
The class also contains getters and setters etc.
Now, if a create a new instance of this class, it will be written as a
serialized object into my database. It works fine, even deserialzation
works.
For better understanding lets call this version of the class "MyClass"
version 1.
Later I made a little change within the class: I only added one more
method (it does't matter what this method does). There nothing else
which is changed in the class.
As is did it before, I create instances of this class and put it as a
serialized object into my database - works fine. Even the
deserialization sems to work.
Lets call this version of the class "MyClass" version 2.
Who knows some things about serialisation of objects, can imagine what
happens now.
Now there are two types of serialiazied objects in my database,
depending on the same class. Because they have different serialUIDs, i
can't now deserialise Objects from version 1 !
My Problem: I need both objects !
Code:
InputStream is = rs.getBlob(1).getBinaryStream();
ObjectInputStream oip = new ObjectInputStream(is);
Object testObject = null;
testObject = oip.readObject(); // Hier fliegt er dann weg !!
Now it is too late, to put the serialUID just as a Long value into the
class. But how can i solve my problem in any way?
Has anyone an idea?
Thx a lot.