• 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

can you pass ResultSet as argument

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

Can you pass Resultset as an argument or input parameter to a method
Can you return ResultSet from a method?

Thanks,
P.Ingle
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by p Ingle:

Can you pass Resultset as an argument or input parameter to a method



Yes


Can you return ResultSet from a method?



Yes, A method where you are executing your query you may return resultset


One point to be noted that an application has several role/operations and you can logically/physically seperate them as per their responsibility.
for example in MVC speration of responsibility are

controlling request
Selection of view
business logic layer

Similarly there is a layer in your application Data layer where you can say you are doing operations related to database. If your question related to data layer then it is ok.such operation should be limited to data layer, else instead of returning a resultset from a method you can return VOs or DTOs.

Shailesh
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or you can look at CachedRowSet, because ResultSet object is bound with the Statement object. However, CacheRowset is independent and made for passing across layers.

JDBC Tutorail says:

A CachedRowSet class�a disconnected rowset that caches its data in memory; not suitable for very large data sets, but an ideal way to provide thin Java clients, such as a Personal Digital Assistant (PDA) or Network Computer (NC), with tabular data
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic