While I've been using Spring in various capabilities for some time now, I've never run across a situation where I've needed to execute a sql query with a duplicated parameter from code utilizing Spring. The following is a simple example of the type of query I ran into:
Using the normal JdbcTemplate.query method with this query would require you to create a two-element array which contains the same value in both elements. Silly DRY violation, right? Luckily, some of the folks behind the Spring JDBC packages decided to include a way to define queries where the values of parameters can be specified by name rather than by index. Here's an example using the named parameter syntax handled by the NamedParameterJdbcTemplate class:
After digging through the Spring's SVN repository, I found that the NamedParameterJdbcTemplate class does not appear to rely on the CallableStatement class for supporting the named parameter functionality. That means that using this class should be safe for all JDBC drivers(which support PreparedStatements), as the named parameters are handled above the JDBC driver's level.