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

Re: Updating classes



On Thu, 20 Jan 2000, Bradley Marshall wrote:
> What is the best way to update a class that's in the
> database?  I made a simple class interface:
> 
> public interface Dna extends OzoneRemote
> {
>     public String getDna();
>     public void setDna(String seq); /*update*/
> }
> 
> I saved one in the database, then tried to add a
> method:
> 
> public interface Dna extends OzoneRemote
> {
>     public String getDna();
>     public void setDna(String seq); /*update*/
>     public String readMe();
> }
> 
> This doesn't work, however.  I get a null-pointer
> exception when I try to pull the old object out with
> the updated Dna.  
The reloadClasses() method does not work currently. So you have to shutdown and
restart the server. (BTW: anybody out there willing to help with the
ClassLoader stuff to make reloadClasses() work?) Afterwards the server will use
the new (and only the new) classes.

If you want to add not only a new method but also a new member, then you should
add a serialVersionUID (and maybe Externalizable methods) to your classes. If
there is an explicite serialVersionUID you can read old data (without the
field) into new classes. Read to Java doc for details.


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