• 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

Disconnected resultsets...

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

I come from a .net world. One of the nice objects within its data access architecture is a "DataTable". This is similar to a resultset but with one significant difference - it is completely disconnected from its datasource. Which, unless I'm missing the point, is different to resultsets in that they hold connections until they are destroyed.

I like writing generic data layers in whatever language I'm using and am seeking to write a generic method that calls a stored procedure that will return multiple rows. I want then to pass this data to other areas of my application. It doesn't look like I can use a resultset as that would leave open connections all over the place.

I know I could write a method that fills a resultset and then populates classes with the contents of this data but this is not generic.

I've already written a class called (drum roll) "DataTable" which converts a resultset to xml which is generic but feels expensive in terms of resources.

Am I venturing down a cul-de-sac of bad practice? If so, what should I be doing?
 
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
Hi Scanlan,

Welcome to Java world, and welcome to Java ranch as well.


One of the nice objects within its data access architecture is a "DataTable".



We do have similar object in java and that is CachedRowSet. You can use the same.



it is completely disconnected from its datasource. Which, unless I'm missing the point, is different to resultsets in that they hold connections until they are destroyed.



CachedRowSet are also disconnected from database, you can release you resultset once you populate your CachedRowSet. Onwards you can use it the way you like to do the programming.


Shailesh
 
reply
    Bookmark Topic Watch Topic
  • New Topic