This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterarting ResultSet Conditionally

 
Pradeep Arun
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am executing a Stored procedure that returns the following resultset.

1, Firstname1, lastname1, homeaddress
1, Firstname1, lastname1, webaddress
1, Firstname1, lastname1, businessaddress
2, Firstname2, lastname2, webaddress
2, Firstname2, lastname2, businessaddress


I am using Spring StoredProcedure and maprow. My Domain object is as below

Class Person {

String firstname;
String lastname;
List address;
}

So one person can have a list of address. But when i use maprow, its returning Object for each record in the resultset where as i need to iterate the resultset conditionally and return it appropriatly. That is i need the maprow to return only after iterating the first three resultset then iterating the next two result set.

is there any way to do this in Spring StoredProcedure? I shouldnt use jdbcTemplate.

Any suggestions?

 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not possible and you shouldn't do that. mapRow means map only one row, not many rows.
 
Pradeep Arun
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
agreed. If not maprow what is the other options available.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could group Person by Id later after getting all rows.
 
pichin pichon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep Arun wrote:agreed. If not maprow what is the other options available.



Hi Pradeep,
I have read your post and I try to make something similar,

can you read my post and tell me what is my problem?

my post: http://www.coderanch.com/t/465377/Spring/StoredProcedure-outParameters-oracle

thanks very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic