title: How to copy resultset into object?
body: <p>I am using the following to add retrieved values to the class. all values will be added to attributes of the class but I am using compisition ( have an object of class in the class) and it does not show anything on output.</p>
  
  <pre><code>class employee 
  {
  ....
  private Address address = new Address();
  .....
  }
   ...
  Employee emp = new Employee();
          try {
  
              ps = con.prepareStatement("select * from employee,address "
                      + "WHERE employee.username = ? AND "
                      + "employee.ADD_ID = address.ID");
  
              ps.setString(1, username);
              ResultSet r = ps.executeQuery();
              if (r.next()) {
  
                  BeanProcessor bp = new BeanProcessor();
                  emp = bp.toBean(r,Employee.class);
                  System.out.println("blockkkk:"+emp.getAddress().getBlock());  
                                              //output of above line is blockkkk:null
              }
  
              con.close();
              ps.close();
          } catch (SQLException e) {
              System.err.println(e.getMessage());
  
          }
         return emp;
  </code></pre>
  
  <p>Address class is as following:</p>
  
  <pre><code>  public class Address {
      .....
      private String block;
      ....
        public String getBlock() {
              return block;
          }
  
          public void setBlock(String block) {
              this.block = block;
          }
      ....
     }
  </code></pre>