title: JDBC Template - One-To-Many
body: <p>I have a class that looks like this.  I need to populate it from two database tables, which are also shown below.  Is there any preferred way to do this?</p>
  
  <p>My thought is to have a service class to select a <code>List&lt;&gt;</code> via a <code>ResultSetExtractor</code> from a DAO.  Then do a <code>foreach</code> on that list, and select a <code>List&lt;&gt;</code> of emails for the individual person via another <code>ResultSetExtractor</code>, and attach it from with the <code>foreach</code> loop.</p>
  
  <p>Is there a better way, or is this as good as it gets?</p>
  
  <pre><code>public class Person {
      private String personId;
      private String Name;
      private ArrayList&lt;String&gt; emails;
  }
  
  
   create table Person (
     person_id  varchar2(10),
     name       varchar2(30)
  );
  
  
  create table email (
    person_id   varchar2(10),
    email       varchar2(30)
  );
  </code></pre>