Announcement Announcement Module
Collapse
No announcement yet.
JdbcTemplate.call question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JdbcTemplate.call question

    The Spring Javadoc for JdbcTemplate.call(CallableStatementCreator, List)
    indicates the second parameter should be a list of SqlParameter objects.
    But SqlParameter objects contain only type information, not value
    information. I'm not sure how the actual values are suppose to be passed
    to the call.

  • #2
    The actual vaues for the parameters are passed into the CallableStatementCreator in this case. This method is used internally by the StoredProcedure class and is not the recommended method to use for executing a call. Either use the StoredProcedure class or use "Object execute(CallableStatementCreator csc, CallableStatementCallback action)".

    Comment


    • #3
      So perhaps my CallableStatementCreator constructor should accept the values I wish to pass. Then I just create a new instance for each call.

      The reason I am resorting to CallableStatementCreator is that I am trying to Spring-wrap a stored procedure call with a function call inside it. This morning I encountered the following SQL in JDBC code:
      Code:
      call pkg_abc.p_get_contributions(?, ?, pkg_lookup.f_get_ctry(?), ?, ?)
      I'm trying to determine a systematic way to code Spring-wrappers for stored procedure calls that are more involved than simply "call myproc(x,y)".

      Comment


      • #4
        In that case use the StoredProcedure class and specify the sql exactly the way it is - {call pkg_abc.p_get_contributions(?, ?, pkg_lookup.f_get_ctry(?), ?, ?)} . Then call setSqlReadyForUse(true) and Spring will not mess with the sql - it will use it as is but will still set the parameters.

        Comment


        • #5
          Yep. That seems to work just fine.

          Thanks,
          - Paul

          Comment

          Working...
          X