This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in executing SimpleJdbcCall for fetching resultset/REF cursor

 
Anadi Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic