title: JDBCTemplate RowMapper for Inner Join
body: <p>Server inform error </p>
  
  <blockquote>
    <p>HTTP Status 500 - Request processing failed; nested exception is
    org.springframework.dao.TransientDataAccessResourceException:
    StatementCallback; SQL [SELECT * FROM Accounts INNER JOIN Comment ON
    Comment.Account_ID=Accounts.Account_ID WHERE Comment.Place_ID=3]; The
    column name Accounts.Account_ID is not valid.; nested exception is
    com.microsoft.sqlserver.jdbc.SQLServerException: The column name
    Accounts.Account_ID is not valid.</p>
  </blockquote>
  
  <p>This is my code in DAO</p>
  
  <pre><code>public List&lt;LoadCommentDTO&gt; loadComment(int placeId) {
          String sql = "SELECT * FROM Accounts INNER JOIN Comment ON Comment.Account_ID=Accounts.Account_ID WHERE Comment.Place_ID="+ placeId ;
          RowMapper&lt;LoadCommentDTO&gt; rowMapper = new CommentRowMapper();
          List&lt;LoadCommentDTO&gt; listComment = jdbcTemplate.query(sql, rowMapper);
          return listComment;
      }
  
      protected class CommentRowMapper implements RowMapper&lt;LoadCommentDTO&gt; {
          @Override
          public LoadCommentDTO mapRow(ResultSet rs, int rowNum) throws SQLException {
              LoadCommentDTO loadCommentDTO = new LoadCommentDTO();
              CommentDTO commentDTO  = new CommentDTO();
              AccountDTO accountDTO = new AccountDTO();
  
              accountDTO.setAccountID(rs.getInt("Accounts.Account_ID"));
              accountDTO.setAvatar_path(rs.getString("Accounts.Avatar_path"));
              accountDTO.setFirstname(rs.getString("Accounts.Firstname"));
              accountDTO.setLastname(rs.getString("Accounts.Lastname"));
  
              commentDTO.setAccount_Id(rs.getInt("Comment.Account_ID"));
              commentDTO.setDescription(rs.getString("CommentDescription"));
              commentDTO.setPlace_ID(rs.getInt("CommentPlace_ID"));
              commentDTO.setC_Date(rs.getString("CommentC_Date"));
  
              loadCommentDTO.setAccountDTO(accountDTO);
              loadCommentDTO.setCommentDTO(commentDTO);
  
              return loadCommentDTO;
          }
      }
  </code></pre>