I'm able to successfully connect to a MySQL
database with SpringMVC
and JDBC
, I can run queries and updates no problem, until I try to add named parameters. Any named parameter and I get the following exception:
nested exception is java.lang.NoSuchMethodError: org.springframework.jdbc.core.StatementCreatorUtils.javaTypeToSqlParameterType
(Ljava/lang/Class;)I] with root cause
I iterated through the params and verified that the id and values are correct and match the text I use when I'm coding the text directly into the query.
Thanks for any help debugging this:
Code that fails:
public boolean create(Beer beer) {
System.out.println("Creating beer in Dao");
System.out.println(beer);
BeanPropertySqlParameterSource params = new BeanPropertySqlParameterSource(beer);
return jdbc.update("insert into beer (beer_name) values (:name)", params) == 1;
}
code that works:
public boolean create(Beer beer) {
System.out.println("Creating beer in Dao");
System.out.println(beer);
BeanPropertySqlParameterSource params = new BeanPropertySqlParameterSource(beer);
return jdbc.update("insert into beer (beer_name) values (\"honey porter\")", params) == 1;
}