0 Replies Latest reply on Jan 21, 2005 5:27 PM by Antonio Goncalves

    CMP With object attributes

    Antonio Goncalves Newbie

      Hi,

      I've got existing POJO/DAO classes and I'm converting them into CMP Beans. Works fine. I've reached the case where I have a class Customer with an attribute Address (another class).

      public final class Customer extends PersistentObject {
      private String _id;
      private String _firstname;
      private String _lastname;
      private final Address _address = new Address();
      }

      public final class Address {
      private String _street1;
      private String _city;
      private String _zipcode;
      }

      To turn that into a CMP you would thing 'well, let's create 2 CMPs, one for Customer and one for address with a relation'. The problem is that I only have one DB Table t_customer with all attributes, but there's not table for address

      CREATE TABLE T_CUSTOMER( id VARCHAR(10), PRIMARY KEY(id), firstname VARCHAR(50) NOT NULL, lastname VARCHAR(50) NOT NULL, street1 VARCHAR(50), city VARCHAR(25), zipcode VARCHAR(10));

      And I don't want to create a second table (t_address). How can I use a CMP and map its composed attributes (address) into the table t_customer ? If I creat a BMP instead I will have problems with relationship between CMPs and BMPs.

      Any help, thanks,

      Antonio