File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes ResultSet JavaBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "ResultSet JavaBean" Watch "ResultSet JavaBean" New topic

ResultSet JavaBean

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362

I'm looking for ways to improve the speed of my SQL search and was thinking JavaBeans might do it.

I have had a little look rounf tinternet to see how to do it, only thing is I'm not sure if I can put all of the results into one BEan or if I need to create a new Bean for each line of the results?

Is there a way of creating an array of get/set for one Bean or wil i need to create a new instance of the Bean each time.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

JavaBeans won't improve the speed of your SQL.
You'll use them to store the db records (usually one bean per record), and arrange them a convenient way for you to retrieve them. For example, using a primary key as the key of a Map.

[My Blog]
All roads lead to JavaRanch
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
If the database that you're using allows for indexes creation, then you should probably being using indexes to speed things up. Index the columns that are used in the WHERE clause.

SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
I agree. Here's the link:
subject: ResultSet JavaBean
It's not a secret anymore!