Open
Description
NamedParameterJdbcTemplate skips parameters in comments by the logic in NamedParameterUtils.parseSqlStatement(String sql)
...
int skipToPosition = i;
while (i < statement.length) {
skipToPosition = skipCommentsAndQuotes(statement, i);
if (i == skipToPosition) {
break;
}
else {
i = skipToPosition;
}
}
...
I use NamedParameterJdbcTemplate to run SQLs on our own DBMS engine in the company.
I have special cases to use parameters in comment, for example, "/*@ queryCkey(:cafeId) */ SELECT ... ",
If it is allowed in NamedParameterJdbcTemplate, it will be very helpful for our system.
( For your information, MyBatis allows parameters in comments of SQL)
I'd like you to consider adding an optional flag to support this.
var template = new NamedParameterJdbcTemplate(dataSource);
template.setAllowParametersInComments(true);