title: JDBI One-To-Many joins and mapping
body: <p>I have following classes:</p>
  
  <pre><code>public class User {
  
      private int id;
      private String name;
      private List&lt;Comment&gt; comments;
      private List&lt;Address&gt; address;
  
      // getters/setters
  }
  
  
  public class Comment {
  
      private int id;
      private String comment;
      ...
      // getters/setters
  }
  
  
  public class Address {
  
      private int id;
      private String streetName;
      ...
      // getters/setters
  }
  </code></pre>
  
  <p>And a user mapper:</p>
  
  <pre><code>public class UserMapper implements ResultSetMapper&lt;User&gt; {
      @Override
      public User map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
          User user = new User();
          user.setId(resultSet.getInt("id"));
          user.setName(resultSet.getString("name"));
  
          // user.setComments 
          // user.setAddresses
  
          return user;
      }
  }
  </code></pre>
  
  <p>Problem I'm trying to solve, is how to set comments and addresses to user. Also how would sql query look like for this?</p>