• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Iterarting ResultSet Conditionally

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could group Person by Id later after getting all rows.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: https://coderanch.com/t/465377/Spring/StoredProcedure-outParameters-oracle

thanks very much.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic