I'm trying to call one of the overloaded query() methods in Spring 3.0's JdbcTemplate class in Scala...
val args: Array[Object] = new Array[Object](1)
args(0) = id
val results: List[MyObj] = jdbcTemplate.query(SQL_STRING, args, new MyJdbcStore.MyObjRowMapper)
...and I get a stack trace that says, "overloaded method value query with alternatives." (The MyObjRowMapper in the above code snippet is a class, defined in MyJdbcStore's companion object, that extends Spring's RowMapper interface.) The "alternatives" are the three versions of query() that have these parameters respectively:
java.lang.String, Array[java.lang.Object], org.springframework.jdbc.core.ResultSetExtractor
java.lang.String, org.springframework.jdbc.core.PreparedStatementSetter, org.springframework.jdbc.core.ResultSet
org.springframework.jdbc.core.PreparedStatementCreator, org.springframework.jdbc.core.PreparedStatementSetter, org.springframework.jdbc.core.ResultSetExtractor
Even though I've explictly defined the return type of the results variable, why can't the compiler determine which query method to call?
java.util.List
or is this a ScalaList
? – Alexey Romanov