Buggy code:
public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations { public static final int DEFAULT_CACHE_LIMIT = 256 ; private final JdbcOperations classicJdbcTemplate ; private volatile int cacheLimit = NamedParameterJdbcTemplate . DEFAULT_CACHE_LIMIT ; @ SuppressWarnings ( "serial" ) private final Map < String , ParsedSql > parsedSqlCache = new LinkedHashMap < String , ParsedSql > ( NamedParameterJdbcTemplate . DEFAULT_CACHE_LIMIT , 0.75F , true ) { @ Override protected boolean removeEldestEntry ( Map . Entry < String , ParsedSql > eldest ) { } } ; public NamedParameterJdbcTemplate ( DataSource dataSource ) { } public NamedParameterJdbcTemplate ( JdbcOperations classicJdbcTemplate ) { } @ Override public JdbcOperations getJdbcOperations ( ) { } public void setCacheLimit ( int cacheLimit ) { } public int getCacheLimit ( ) { } @ Override public < T > T execute ( String sql , SqlParameterSource paramSource , PreparedStatementCallback < T > action ) throws DataAccessException { } @ Override public < T > T execute ( String sql , Map < String , ? > paramMap , PreparedStatementCallback < T > action ) throws DataAccessException { } @ Override public < T > T execute ( String sql , PreparedStatementCallback < T > action ) throws DataAccessException { } @ Override public < T > T query ( String sql , SqlParameterSource paramSource , ResultSetExtractor < T > rse ) throws DataAccessException { } @ Override public < T > T query ( String sql , Map < String , ? > paramMap , ResultSetExtractor < T > rse ) throws DataAccessException { } @ Override public < T > T query ( String sql , ResultSetExtractor < T > rse ) throws DataAccessException { } @ Override public void query ( String sql , SqlParameterSource paramSource , RowCallbackHandler rch ) throws DataAccessException { } @ Override public void query ( String sql , Map < String , ? > paramMap , RowCallbackHandler rch ) throws DataAccessException { } @ Override public void query ( String sql , RowCallbackHandler rch ) throws DataAccessException { } @ Override public < T > List < T > query ( String sql , SqlParameterSource paramSource , RowMapper < T > rowMapper ) throws DataAccessException { } @ Override public < T > List < T > query ( String sql , Map < String , ? > paramMap , RowMapper < T > rowMapper ) throws DataAccessException { } @ Override public < T > List < T > query ( String sql , RowMapper < T > rowMapper ) throws DataAccessException { } @ Override public < T > T queryForObject ( String sql , SqlParameterSource paramSource , RowMapper < T > rowMapper ) throws DataAccessException { } @ Override public < T > T queryForObject ( String sql , Map < String , ? > paramMap , RowMapper < T > rowMapper ) throws DataAccessException { } @ Override public < T > T queryForObject ( String sql , SqlParameterSource paramSource , Class < T > requiredType ) throws DataAccessException { } @ Override public < T > T queryForObject ( String sql , Map < String , ? > paramMap , Class < T > requiredType ) throws DataAccessException { } @ Override public Map < String , Object > queryForMap ( String sql , SqlParameterSource paramSource ) throws DataAccessException { } @ Override public Map < String , Object > queryForMap ( String sql , Map < String , ? > paramMap ) throws DataAccessException { } @ Override @ Deprecated public long queryForLong ( String sql , SqlParameterSource paramSource ) throws DataAccessException { } @ Override @ Deprecated public long queryForLong ( String sql , Map < String , ? > paramMap ) throws DataAccessException { } @ Override @ Deprecated public int queryForInt ( String sql , SqlParameterSource paramSource ) throws DataAccessException { } @ Override @ Deprecated public int queryForInt ( String sql , Map < String , ? > paramMap ) throws DataAccessException { } @ Override public < T > List < T > queryForList ( String sql , SqlParameterSource paramSource , Class < T > elementType ) throws DataAccessException { } @ Override public < T > List < T > queryForList ( String sql , Map < String , ? > paramMap , Class < T > elementType ) throws DataAccessException { } @ Override public List < Map < String , Object > > queryForList ( String sql , SqlParameterSource paramSource ) throws DataAccessException { } @ Override public List < Map < String , Object > > queryForList ( String sql , Map < String , ? > paramMap ) throws DataAccessException { } @ Override public SqlRowSet queryForRowSet ( String sql , SqlParameterSource paramSource ) throws DataAccessException { } @ Override public SqlRowSet queryForRowSet ( String sql , Map < String , ? > paramMap ) throws DataAccessException { } @ Override public int update ( String sql , SqlParameterSource paramSource ) throws DataAccessException { } @ Override public int update ( String sql , Map < String , ? > paramMap ) throws DataAccessException { } @ Override public int update ( String sql , SqlParameterSource paramSource , KeyHolder generatedKeyHolder ) throws DataAccessException { } @ Override public int update ( String sql , SqlParameterSource paramSource , KeyHolder generatedKeyHolder , String [ ] keyColumnNames ) throws DataAccessException { } @ Override public int [ ] batchUpdate ( String sql , Map < String , ? > [ ] batchValues ) { } @ Override public int [ ] batchUpdate ( String sql , SqlParameterSource [ ] batchArgs ) { <START_BUG> ParsedSql parsedSql = this . getParsedSql ( sql ) ; <END_BUG> return NamedParameterBatchUpdateUtils . executeBatchUpdateWithNamedParameters ( parsedSql , batchArgs , getJdbcOperations ( ) ) ; } protected PreparedStatementCreator getPreparedStatementCreator ( String sql , SqlParameterSource paramSource ) { } protected ParsedSql getParsedSql ( String sql ) { } }

Fix:
ParsedSql parsedSql = getParsedSql ( sql ) ;