Link to home
Start Free TrialLog in
Avatar of ontheball
ontheball

asked on

Need to return multiple instances

I am editing some code where i am return a result set and dumping it into a particular instances of a class.  Right now I am only getting one instances of the class being created.  Previously there was only one record being returned from the DB, but now there is two.  Only one instance is being created though.  

From what I can see this is the method that needs to be dealt with.

Any suggestion welcome!

private void initializeColl(java.sql.ResultSet x) {
     this.x = new Vector(15);
     try {
          while (x.next()) {
               this.x.add(new Amount(
                              x.getString("NAME"),
                              new Double(x.getString("FIRST_AMOUNT")),
                              new Double(x.getString("NEXT_AMOUNT")),
                              x.getString("DATE"),
                              ));
          }
     }
     catch (java.sql.SQLException sqle) {
          sqle.printStackTrace();
     }
}
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sfotex
sfotex

or try a count query against the dabase before you
get the resultset...
ontheball:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept CEHJ's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thomas Boshell
EE Cleanup Volunteer