Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-16709

SimpleJdbcCall with rowMapper set fails on execution (on Postgres)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Investigating
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.3.15
    • Fix Version/s: None
    • Component/s: Data:JDBC
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      Further to my previous issue SPR-16611.

      spring-jdbc: 4.3.15
      org.postgresql:postgresql: 9.4.1212.jre7

      I've got 4.3.15 yesterday. And tested it with demo project which I attached to SPR-16611. Test passes, so issue is resolved, thank you.

      I wrote a stored function that returns a table row. When I call it returning a map of values, everything works properly. But when I set jdbcCall.returningResultSet("resultvalue", rowMapper), something goes wrong:

      org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar [{? = call find_customer(?, ?)}]; nested exception is org.postgresql.util.PSQLException: A CallableStatement function was executed and the out parameter 1 was of type java.sql.Types=4 however type java.sql.Types=1111 was registered.
      at org.postgresql.jdbc.PgCallableStatement.executeWithFlags(PgCallableStatement.java:140)
      at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:157)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
      at com.sun.proxy.$Proxy90.execute(Unknown Source)
      at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1144)
      at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1141)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1089)
      at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1141)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:406)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:366)
      at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:197)
      at com.example.demo.DemoApplicationTests.callProcedureReturningResultSetWithRowMapper(DemoApplicationTests.java:54)

      I attach the sample project below.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              ivan.vasilev Ivan Vasilev
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Days since last comment:
                3 years, 31 weeks, 2 days ago