commons-user mailing list archives

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

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,

       Iterator rows = rss.iterator();

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

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.


View raw message