Java BeanUtils - RowSetDynaClass


The RowSetDynaClass copies the undisclosed data in the DynaBeans memory while creating an instance which displays the result and using this class, you can close the ResultSet data before proceeding the actual data that was returned. The drawback of this class is, you need to pay for the memory cost for copying the result data. It is more useful in the web application process.

The main features of RowSetDynaClass are:

  • It can be used to implement the (Serializable is an interface that does not contain any specific methods) to make classes serialized and deserialized.

  • You can transfer the results of SQL query to remote Java based client application such as applet by using this class.

The usage pattern of RowSetDynaClass will look like as shown below:

Connection cn = ...;  // Obtain the connection 
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery("SELECT ...");
RowSetDynaClass dc = new RowSetDynaClass(rs);
...;                    // Returns the connection
List rows = dc.getRows();
...;                   // Processes the rows as desired