title: How to use JdbcTemplate to perform Join queries
body: <p>I have the following database model</p>
  
  <pre><code>       create table Diary (id bigint NOT NULL AUTO_INCREMENT,
                  creationDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                  name varchar(255) not null, 
                  description text,
                  viewtype varchar(255) not null,
                  member bigint,
                  primary key (id),
                  foreign key (member) references Member(id));
  
  
         create table Page (id bigint NOT NULL AUTO_INCREMENT,
                  creationDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                  viewtype varchar(255) not null,
                  diary bigint,
                  member bigint,
                  primary key (id),
                  foreign key (diary) references Diary(id),
                  foreign key (member) references Member(id));
  
         create table Comment (id bigint NOT NULL AUTO_INCREMENT,
                  postingDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                  comment text not null,
                  page bigint,
                  member bigint,
                  primary key (id),
                  foreign key (page) references Page(id)
                  foreign key (member) references Member(id));
  </code></pre>
  
  <p>I am using spring JDbc template.</p>
  
  <pre><code>      My interface looks like follows: accountid is the memeberid in the database.
  
       Collection&lt;Diary&gt; getDiaries(Long accountId);
  </code></pre>
  
  <p>And my diary looks like follows:</p>
  
  <pre><code>           public class Diary {
             private Collection&lt;Page&gt; pages;
             private Long id;
             private LocalTime creationDate;
             private String name;
             private String description;
             private ViewType type;
             }
  </code></pre>
  
  <p>I wanted to know how the query will look now if I wanted to prepare a Diary Object using jdbc template. Is is also possible to just fire only one query and just prepare this Diary object because I will avoid for same request multiple firing of queries. For the above interface its very possible that I will be using s join query or is there any more simpler way possible using spring JDBC template framework.</p>