title: Populate List of entity class objects from sql ResultSet
body: <p>So I have this sql query:</p>
  
  <pre><code>    "select company, surveys.surveyID, questionID, question, questionScore FROM surveys INNER JOIN (SELECT * FROM companies INNER JOIN "
              + "(SELECT * FROM questions INNER JOIN categories "
              + "ON questions.catID = categories.catID) AS cats "
              + "ON companies.questionID = cats.questionID) AS yes "
              + "ON yes.surveyID = surveys.surveyID WHERE company=?"
  </code></pre>
  
  <p>'cats' and 'yes' have no meaning and are just victums of my extremely verbose naming scheme.</p>
  
  <p>company is just a string.</p>
  
  <p>The table it returns would look like this:</p>
  
  <pre><code> ---------------------------------------------
  |companyName|surveyID|questionID|questionScore|
   ---------------------------------------------
  </code></pre>
  
  <p>The primary key for this table is (companyName, surveyID AND QuestionID) because each company can have multiple surveys, each survey has a number of questions.</p>
  
  <p>Then I have this class:</p>
  
  <pre><code>public class Company
  {
  private String companyName;
  private String surveyorName;
  private String surveyorTitle;
  private int surveyID;
  private Map&lt;Integer,Integer&gt; questions;
  
  public Company(String name, String surveyor, String surveyerTitle,
      int surveyID, Map&lt;Integer, Integer&gt; questions)
  {
  this.companyName = name;
  this.surveyorName = surveyor;
  this.surveyorTitle = surveyerTitle;
  this.surveyID = surveyID;
  this.questions = questions;
  }
  </code></pre>
  
  <p>With a all the getters and setters</p>
  
  <p>For example, say there is a company Mens Insamen. SurveyID is 1.
  So</p>
  
  <pre><code>Mens Insamen    1       q1     3
  Mens Insamen    1       q2     1
  </code></pre>
  
  <p>etc...</p>
  
  <p>Now I need to populate a List of Company objects with the data from the sql query. I have tried for a while but couldn't really come up with anything. </p>
  
  <p>If it is (unsurprisingly) unclear (fokol (no) coffee) I can improve it at some point.</p>
  
  <p>Thanks in advance</p>