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

Re: Designing a OO database model



On Thu, 23 Mar 2000, Jon Finanger wrote:
> Since OODB is pretty new, some questions arise regarding to the design of OO
> database model:
> Since Ozone uses RMI one need to work with interfaces (to create the
> proxies). Am i right when i say that if you're going to make an inheritance
> hierarchy like this: Emplyee inherits from Person
> you have to do it using interface inheritance?
> 
> or do i just implement a PersonContainer interface and uses a
> setPerson(Person p) method in that to store a serializable Employee object
> or some other Person?
> 
> or have i completely misunderstood :)

I've enhanced the simple sample from the distro a bit. I hope it shows now how
to handle a (simple) inheritance hierarchy:

public interface Auto extends OzoneRemote {
   public void print();
   public void setName (String newName);
   public String name();
   public Auto doSomthing (Auto auto) throws Exception;
   }

public class AutoImpl extends OzoneObject implements Auto {
   public AutoImpl() {
      }
   ...
   }

public interface Bus extends Auto {
   }

public class BusImpl extends AutoImpl implements Bus {
   public BusImpl() {
      }

   public String toString() {
     // System.out.println ("toString()...");
      return "Bus:" + name + ", " + String.valueOf(age) + ", " + capacity;
      }
   }

Client.java:
       ...
       Bus bus = (Bus)db.createObject (BusImpl.class.getName());
       System.out.println ("bus:" + bus);
       bus.print();
       bus.setName ("name");
       db.deleteObject (bus);
       ....


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