I would like to pass an array of strings to a stored procedure with jdbcTemplate and am having trouble doing so. This is the query:
"SELECT * from stored_procedure(?::text[])"
This is how I am calling the stored procedure with the jdbcTemplate (where notes is a List):
jdbcTemplate.queryForObject(sql, Long.class, notes == null ? null : notes.toArray());
This is the error I get:
PreparedStatementCallback; bad SQL grammar [SELECT * from stored_procedure(?::text[])]; nested exception is org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of [Ljava.lang.Object;. Use setObject() with an explicit Types value to specify the type to use.
I haven't found anything online for fixing this problem.