title: JDBCTemplate query use arguments many times
body: <p>In JDBCTemplate, I'm calling</p>
  
  <pre><code>public &lt;T&gt; List&lt;T&gt; query(String sql, Object[] args, RowMapper&lt;T&gt; rowMapper) throws DataAccessException {
              return query(sql, args, new RowMapperResultSetExtractor&lt;T&gt;(rowMapper));
          }
  </code></pre>
  
  <p>with </p>
  
  <pre><code>getJdbcTemplate().query(usersByUsernameQuery, new String[] {username}, new RowMapper&lt;UserDetails&gt;()
  </code></pre>
  
  <p>My problem is I only have access to the <em>usersByUsernameQuery</em> argument, and I want to use the 'username' variable twice in it. For example:</p>
  
  <pre><code>usersByUsernameQuery = "Select * from ... ... where someColumn=? or anotherColumn=?" 
  </code></pre>
  
  <p>Since I'm only passing a string array with one element (username), how should I build my query?</p>