This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Exception in executing SimpleJdbcCall for fetching resultset/REF cursor

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I get null pointer exceptions while executing a SimpleJdbcCall(Spring 2.5.4) based implementation of calling stored procedures, posted the same query in sppring forums but haven't got any help yet so I am posting it here again.

Hi

I was trying a bit modified usage of this class for a procedure that accepts one input and returns all rows of the table in question. Some what similar to an example given for the same in spring reference the only difference being that the procedure i call has an input as well.

The stored procedure being called in my code is as follows


I used the SimpleJdbcCall as follows


I got the following exception when in run the class

 
Anadi Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I changed the procedure definition as follows and then retried(am not that good with stored procedures )



I modified the EventDaiImpl class to add print statements, the previous exception did not occur as expected but now i get Null pointer exception


the debug mode shows that the resultMap has only Null Values
an extract is as follows


Please point out whats done wrong here, something in the class or the procedure may be?
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Um, don't you have to tell it all the parameters, not just the first one. It needs to also be told the out parameters. I think.

Don't you need more useOutParameterNames?

.useInParameterNames("IN_TITLE").returningResultSet("events",ParameterizedBeanPropertyRowMapper.newInstance(Event.class));

Mark
 
Anadi Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The SimpleJdbcCall class does not require that we explicitly tell all the parameters the code is like staright from the spring reference for version 2.5.5 the only difference is thatthey gave a nexample of a procedure with no input param and returning a result set/REF Cursor.

We have many procedures in our system which take a parameter or two and return a result set, so i was trying this modification to check how it works with this class
 
Anadi Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This more strange than I had imagined, i did some small modifications in the code to figure out why is it going wrong.



I am totally confused now on what is happening here, i was expecting a sort of Map with ID as the key and the domain objects (Event) and values. What is happening is that all the out params in the procedure are keys and I end up getting the last row of the result only in this map.
[ August 29, 2008: Message edited by: Anadi Misra ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic