0 Replies Latest reply on Dec 2, 2002 10:13 AM by Dzidas

    TransferObject and Entity bean(CMP)

    Dzidas Newbie

      Hello,
      I try use simple TransferObject. Then I inherent this in Entity bean and bean uses same rows. But if I try get value from bean, value was null.
      Why?
      My TO class:
      public class userTO implements java.io.Serializable
      {
      public String name;
      public String login;
      public String lname;
      public String passwd;
      public Integer id;
      public String tstamp;
      // default constructor
      public userTO() {}

      // constructor accepting all values
      public userTO(String name, String login, String lname, String passwd, Integer id, String tstamp){
      init( name, login, lname, passwd, id, tstamp);
      }

      // constructor to create a new TO based
      // using an existing TO instance
      public userTO(userTO contact) {
      System.out.println(contact.name);
      init (contact.name,contact.login, contact.lname,contact.passwd,contact.id,contact.tstamp);
      }

      // method to set all the values
      public void init(String name, String login, String lname, String passwd, Integer id, String tstamp)
      {
      this.name = name;
      this.login = login;
      this.lname = lname;
      this.passwd = passwd;
      this.id = id;
      this.tstamp = tstamp;
      }

      // create a new Transfer Object
      public userTO getData() {
      return new userTO(this);
      }
      }
      My entity bean is standart CMP bean and has set and get methods.
      Maybe I can get info about how is generate CMP bean and understand why TO.name != entity.name
      Thanks