Results 1 to 4 of 4

Thread: ignoring result sets

  1. #1
    Join Date
    Dec 2004
    Posts
    1

    Default ignoring result sets

    Hi,

    I have a sybase stored proc that can return an indeterminate number of result sets while it is working, finally returning a status. I want to ignore those result sets silently.

    If I just dont add a SqlReturnResultSet parameter to my StoredProcedure object, I get warnings in the log file (ResultSet returned from stored procedure but a corresponding SqlReturnResultSet parameter was not declared).

    What I did was to subclass the JdbcTemplate:
    Code:
        
    class MyProc extends StoredProcedure {
        public static final String SQL = "my_proc";
            
        public MyProc () {
            setJdbcTemplate(new JdbcTemplate() {
                /**
                 * overridden to silently ignore any returned result sets
                 */
                protected Map extractReturnedResultSets(CallableStatement cs, List parameters, int updateCount) throws SQLException {
                    logger.debug ("ignoring result sets");
                    return Collections.EMPTY_MAP;
                }
            });
        setDataSource(dataSource);
        setFunction(true);
        setSql(SQL);
        ...
    Question: will this break anything? From what I can tell no, but I'd like to be sure...

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    Personnaly I would create a new stored procedure that does the job and does not return any resultsets.
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3
    Join Date
    Aug 2004
    Posts
    1,107

    Default

    I don't think you are breaking anything except for compatibility with future faremework modifications.

    Thinking a bit more about this, it might not be a bad idea to provide a specialization of the SqlReturnResultSet parameter that could handle any resultsets encountered. This parameter would have to be generic enough to handle the possible resultsets returned and in your case it could simply ignore them.

    I'll post something when I have more details.
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

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

    Default

    I have added a new issue (SPR-593) in Jira for this.
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

Similar Threads

  1. Using JDBCTemplate to handle stored proc result sets
    By too_many_details in forum Data
    Replies: 5
    Last Post: Dec 20th, 2007, 03:38 PM
  2. Replies: 0
    Last Post: Sep 21st, 2005, 10:42 AM
  3. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  4. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM
  5. Unclosed Hibernate Connection
    By jvargas in forum Data
    Replies: 4
    Last Post: Mar 28th, 2005, 01:24 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
  •