Implementation of DynaClass that creates an in-memory collection
of DynaBean s representing the results of an SQL query. Once the
DynaClass instance has been created, the JDBC ResultSet
and Statement on which it is based can be closed, and the
underlying Connection can be returned to its connection pool
(if you are using one).
The normal usage pattern is something like:
Connection conn = ...; // Acquire connection from pool
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT ...");
RowSetDynaClass rsdc = new RowSetDynaClass(rs);
rs.close();
stmt.close();
...; // Return connection to pool
List rows = rsdc.getRows();
...; // Process the rows as desired
Each column in the result set will be represented as a DynaBean
property of the corresponding name (optionally forced to lower case
for portability). There will be one DynaBean in the
List returned by getRows() for each
row in the original ResultSet.
In general, instances of RowSetDynaClass can be serialized
and deserialized, which will automatically include the list of
DynaBean s representing the data content. The only exception
to this rule would be when the underlying property values that were
copied from the ResultSet originally cannot themselves
be serialized. Therefore, a RowSetDynaClass makes a very
convenient mechanism for transporting data sets to remote Java-based
application components.
Implementation of DynaClass that creates an in-memory collection of DynaBean s representing the results of an SQL query. Once the DynaClass instance has been created, the JDBC
ResultSetandStatementon which it is based can be closed, and the underlyingConnectioncan be returned to its connection pool (if you are using one).The normal usage pattern is something like:
Connection conn = ...; // Acquire connection from pool Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT ..."); RowSetDynaClass rsdc = new RowSetDynaClass(rs); rs.close(); stmt.close(); ...; // Return connection to pool List rows = rsdc.getRows(); ...; // Process the rows as desiredEach column in the result set will be represented as a DynaBean property of the corresponding name (optionally forced to lower case for portability). There will be one DynaBean in the
Listreturned bygetRows()for each row in the originalResultSet.In general, instances of RowSetDynaClass can be serialized and deserialized, which will automatically include the list of DynaBean s representing the data content. The only exception to this rule would be when the underlying property values that were copied from the
ResultSetoriginally cannot themselves be serialized. Therefore, a RowSetDynaClass makes a very convenient mechanism for transporting data sets to remote Java-based application components.