commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hardy, Derek" <Derek.Ha...@astrazeneca.com>
Subject [beanUtils] Incorrect number of rows when creating a ResultSetDyn aClass from a ResultSet
Date Mon, 21 Jul 2003 10:49:27 GMT
Hi

I'm using the "standard/example" code to copy a series of values from a
result set (based on a query to an Oracle database) into an ArrayList for
later use.

The code is as follows 

      ResultSet rs = stmt.executeQuery(sql);
      ArrayList results = new ArrayList(); 
      ResultSetDynaClass rss = new ResultSetDynaClass(rs);

       BasicDynaClass bdc =
           new BasicDynaClass("foo", BasicDynaBean.class,
                              rss.getDynaProperties());

       Iterator rows = rss.iterator();

       while (rows.hasNext()) {
           DynaBean oldRow = (DynaBean) rows.next();
           DynaBean newRow = bdc.newInstance();
           PropertyUtils.copyProperties(newRow, oldRow);
           results.add(newRow);
       }


But there only seems to be one row in the results ArrayList, despite there
being 5 rows in the database.

Does anybody know why this could be so?

Thanks in advance.

Derek

Mime
View raw message