I'm doing some
testing that involves database access using spring framework. I understand that I can create a query using a single bind variable using the following statement:
int countOfActorsNamedJoe = this.jdbcTemplate.queryForInt(
"select count(*) from t_actor where first_name = ?", "Joe");
I'm trying to use the queryForObject implementation described in the Spring docs (url at bottom). I have two questions about this. First I'm trying a simple implementation like this:
But it's giving me an error under queryForObject saying
The method queryForObject(String, Object[], RowMapper) in the type JdbcTemplate is not applicable for the arguments (String, String, ActorMapper)
So my first question is how do I get that working?
My second question is how do I use multiple bind variables? Let's say I wanted to say
SELECT * FROM actors WHERE first_name = XXX AND last_name = YYY"
How would I do that?
Thanks
http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jdbc/core/JdbcTemplate.html#queryForObject%28java.lang.String,%20java.lang.Object[],%20java.lang.Class%29