Results 1 to 5 of 5

Thread: JdbcTemplate.call question

  1. #1
    Join Date
    Jul 2005
    Location
    Los Angeles, USA
    Posts
    25

    Default 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. #2
    Join Date
    Aug 2004
    Posts
    1,104

    Default

    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)".
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  3. #3
    Join Date
    Jul 2005
    Location
    Los Angeles, USA
    Posts
    25

    Default

    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)".

  4. #4
    Join Date
    Aug 2004
    Posts
    1,104

    Default

    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.
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  5. #5
    Join Date
    Jul 2005
    Location
    Los Angeles, USA
    Posts
    25

    Default

    Yep. That seems to work just fine.

    Thanks,
    - Paul

Similar Threads

  1. Forgot password (e.g. secret question) using Acegi
    By lowerymb77 in forum Security
    Replies: 1
    Last Post: Oct 16th, 2005, 10:46 PM
  2. Replies: 3
    Last Post: Apr 3rd, 2005, 04:34 PM
  3. Messaging question
    By tentacle in forum Architecture
    Replies: 6
    Last Post: Dec 20th, 2004, 08:33 AM
  4. Replies: 6
    Last Post: Oct 8th, 2004, 02:21 PM
  5. Question regarding code in UI classes
    By dortman in forum Swing
    Replies: 5
    Last Post: Sep 22nd, 2004, 07:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •