title: Creating a Java Bean from master Detail Table - Perfomance issue
body: <p>I am creating a java bean from a master detail table. Lets call the master table A and Detail table B. When I make this in to a java bean I have BeanA and BeanB. BeanA will have all the relavant rows in the A table and will also have a list collection of BeanB (detail table B) based on the primarykey. So BeanA will look like </p>
  
  <pre><code>class BeanA {
      String property1;
      String Property2;
      List&lt;BeanB&gt; lstpropery; //This is the data of detail table based on the primary key
  }
  </code></pre>
  
  <p>In this scenerio I am using Spring JDBC to query the table. So when I query the table A and loop through the resultset and set the BeanA properties, I will also set the lstproperty by doing the query to B table.</p>
  
  <p>so the code will be </p>
  
  <pre><code>String qry = "select * from A';
  result =  this.queryTemplate.query(qry, obj, new RowMapper(){
      public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
         BeanA bean1= new BeanA();                         
         bean1.setProperty1(rs.getString(1));
         bean1.setProperty2(rs.getString(2));
         bean1.setLstpropery(callTableB(String primaryKey)); // I see a performance issue here
         return bean1;
      }
  });
  </code></pre>
  
  <p>Is there a better way to do this?</p>