• Post Reply Bookmark Topic Watch Topic
  • New Topic

preferred collection class for storing Resultset?  RSS feed

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is the preferred collection class to use for storing database ResultSets?
I have multiple columns in the result set, and I combine them into their own data structure for each row. Which is the best Collection class to store the objects??
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Bala Krishniah:
Which is the preferred collection class to use for storing database ResultSets?
I have multiple columns in the result set, and I combine them into their own data structure for each row. Which is the best Collection class to store the objects??


I've always found ArrayLists to be sufficient ( better than Vectors ).
 
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why ArrayLists is better than Vectors ?
Thanks a lot.
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, ArrayList & Vector are pretty much the same besides the fact that the methods in the vector class are synchronized. If you don't need synchronization, then use an ArrayList.
 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used CachedRowSet which is like resultset but remains alive after closing the connection. After that I sometimes make a bespoke bean for the data object and instantiate it in an array big enough (from .size() of the CachedRowSet)

Adam
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!