Discussion:
[Ozone-users] Incremental development
Aidan Slingsby
2006-01-13 11:13:07 UTC
Permalink
When a new method is added to an ozone object, existing persistent instances
in the database no longer work. If there a way of easily updating all the
instances in the database to the new class definition, or can this only be
done by keeping the old class definition too and create new instances of the
new class, copying the data over and deleting the old ones (or using XML or
ASCII export/import)? With relational databases, it is relatively easy to
change table design without corrupting the data - can this be the case in
Ozone too (if I do something differently).

Thanks,
Aidan
Leo Mekenkamp
2006-01-13 11:16:10 UTC
Permalink
Post by Aidan Slingsby
When a new method is added to an ozone object, existing persistent instances
in the database no longer work. If there a way of easily updating all the
instances in the database to the new class definition, or can this only be
done by keeping the old class definition too and create new instances of the
new class, copying the data over and deleting the old ones (or using XML or
ASCII export/import)? With relational databases, it is relatively easy to
change table design without corrupting the data - can this be the case in
Ozone too (if I do something differently).
What exactly do you mean by 'no longer work'?
Aidan Slingsby
2006-01-13 11:29:01 UTC
Permalink
Post by Leo Mekenkamp
Post by Aidan Slingsby
When a new method is added to an ozone object, existing persistent
instances in the database no longer work. If there a way of easily
updating all the instances in the database to the new class
definition, or can this only be done by keeping the old class
definition too and create new instances of the new class, copying the
data over and deleting the old ones (or using XML or ASCII
export/import)? With relational databases, it is relatively easy to
change table design without corrupting the data - can this be the case
in Ozone too (if I do something differently).
What exactly do you mean by 'no longer work'?
What I mean is that if write a CarImpl class, store some data in an Ozone
database, then edit the code and add fields and methods to get and set a
colour for the car, run OPP again and try and retrieve a car (stored before
the class was modified) it will say that the class isn't found (if I'm not
mistaken). I can understand why adding a new field would cause problems
(the binary storage is different). Anyway, in a relational database, one
could just add a new 'colour' column. I wondered if something like this
could easily be done in Ozone.

Thanks,
Aidan.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Leo Mekenkamp
2006-01-13 11:34:02 UTC
Permalink
Post by Aidan Slingsby
Post by Leo Mekenkamp
Post by Aidan Slingsby
When a new method is added to an ozone object, existing persistent
instances in the database no longer work. If there a way of easily
updating all the instances in the database to the new class
definition, or can this only be done by keeping the old class
definition too and create new instances of the new class, copying the
data over and deleting the old ones (or using XML or ASCII
export/import)? With relational databases, it is relatively easy to
change table design without corrupting the data - can this be the case
in Ozone too (if I do something differently).
What exactly do you mean by 'no longer work'?
What I mean is that if write a CarImpl class, store some data in an Ozone
database, then edit the code and add fields and methods to get and set a
colour for the car, run OPP again and try and retrieve a car (stored before
the class was modified) it will say that the class isn't found (if I'm not
mistaken). I can understand why adding a new field would cause problems
(the binary storage is different). Anyway, in a relational database, one
could just add a new 'colour' column. I wondered if something like this
could easily be done in Ozone.
If the class is not found you have a classpath problem. But I am afraid
that unless you know what the exact error is, noone can help you
elaborate on the cause...
Aidan Slingsby
2006-01-13 12:24:19 UTC
Permalink
Post by Leo Mekenkamp
If the class is not found you have a classpath problem. But I am afraid
that unless you know what the exact error is, noone can help you elaborate
on the cause...
It's more of a theoretical question (I haven't tried it for a while).

To rephrase it...

Is is possible to *modify* an Ozone class (add fields and methods) without
losing data from already existing instances of the class (in a database)
before the class was modified?

For example, if a "colour" field and accessor method is added to a CarImpl
class and methods to the Car interface, is it possible to use this class to
retrieve existing data in the database stored under the original class
(before the change). Last time I tried something like this, I got a
incompatible class or class not found error (sorry, I don't remember which).

If no error is expected when doing this, I'll just go away and try it again.

Aidan.
Leo Mekenkamp
2006-01-13 13:17:05 UTC
Permalink
Post by Aidan Slingsby
Is is possible to *modify* an Ozone class (add fields and methods) without
losing data from already existing instances of the class (in a database)
before the class was modified?
Yes, as long as you stay within certain boundaries as defined in the
java serialization api.

Loading...