Reputation: 4568
I have MySQL stored routines and need to call them from my Java Spring application. Currently I do it like this:
result = org.springframework.jdbc.core.JdbcTemplate.query(
"CALL MyRoutine(?, ?);",
myRowMapper,
parameterOne,
parameterTwo);
Questions:
Upvotes: 0
Views: 498
Reputation: 4604
#setX(String, X)
methods on CallableStatement
. This may not be supported by your database driver. This is different from NamedParameterJdbcTemplate
which still binds by index. Also note that NamedParameterJdbcTemplate
has some overhead as it parses and rewrites your query.Upvotes: 1
Reputation: 26888
You can get around the parameter order by using NamedParameterJdbcTemplate
. See http://static.springsource.org/spring/docs/3.0.x/reference/jdbc.html
Upvotes: 1