Interface, abstract classes and Cayenne

From: Eddy Young (jeyoun..riscimon.com)
Date: Sun Apr 18 2004 - 06:41:20 EDT

  • Next message: Andrus Adamchik: "Re: Interface, abstract classes and Cayenne"

    Hi all,

    1. Is it possible to use interfaces with Cayenne? For example:

    interface Registry {

       public String getId();
       public String getName();
       public void setName(String name);
       public Collection getRegistrars();
       public void addRegistrar(Registrar registrar);
       public void removeRegistrar(Registrar registrar);
    }

    class RegistryImpl extends RegistryEntity implements Registry {

       public String getId() {
          return super.getId();
       }

       public String getName() {
          return super.getName();
       }

       public void setName(String name) {
          super.setName(name);
       }

       public Collection getRegistrars() {
          return super.getRegistrarList();
       }

       public void addRegistrar(Registrar registrar) {
          super.addToRegistrarList( (RegistrarEntity) registrar);
       }

       public void removeRegistrar(Registrar registrar) {
          super.removeFromRegistrarList( (RegistrarEntity) registry);
       }
    }

    NOTE: RegistryEntity and RegistrarEntity are the classes that are
    generated by the modeler.

    2. Is it possible to map object attributes to the same table? For
    example:

    class Contact implements ContactEntity {

       private Address address;

       ...
       public Address getAddress() {
          return address;
       }
       ...
    }

    Can the attributes of the Address class be mapped onto fields of the
    same table as that of the ContactEntity?

    Thank you in advance.

    -- 
    Eddy Young
    

    Homepage http://coding.mu/ Fingerprint F5DD 6ABA DBE8 F6D5 B561 D3B9 E76C 5C6B F353 225F



    This archive was generated by hypermail 2.0.0 : Sun Apr 18 2004 - 07:10:46 EDT