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