[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object ewoluation.



On Fri, 03 Mar 2000, Radoslaw Wisniewski wrote:
> I've made a Class named Person with one property "name".
> I've made one instance and I've set value of property "name" to "Radek
> Wisniewski".
> 
> I've added new property to class Person - "age", and new mathod "setAge"
> and new method "age" for viewing value of age and I'v updated method
> toString.
> 
> Now I've restartded server and I've invoked new method "age" (getting age)
> for my old, previously created object Person.
> I've got an error:
> 
> warning: ObjectState: proxy(): unable to create proper proxy object.
> warning: Transaction: ta(-73) aborting... (java.io.IOException:
> java.io.InvalidClassException: OsobaImpl; Local class not compatible:
> stream classdesc serialVersionUID=-9118830836401245661 local class
> serialVersionUID=2483986366787418531)
> 
> It mean that I can't use my old objects :((( if I change Class definition. 
> Why Ozone doesn't automatycaly update old Instances of the same Class if
> it is changed?
> It is inpossible or not implemented yet? 
> Does another ODBMS make such things?

There are several ways to solve this problem. The quick solution is to set
'serialVersionUID' in your class (see Serialization doc for detail). This will
allow you to add new methods and members to the classes and initialize them
with old data that is stored in the database.

We really need a good documentation that covers such things...


Falko
-- 
______________________________________________________________________
Falko Braeutigam                         mailto:falko@softwarebuero.de
softwarebuero m&b (SMB)                    http://www.softwarebuero.de