What is FilteredRowSet?

A filteredRowSet object allows one to limit number of rows that are visible in a RowSet so that a person can work with relevant data each time. Limits for data put by filters. You can add more than one filters to a FilteredRowSet when each time you have to work with different set of data.
Now there is one question. Can these filtering be done by SQL query using where clause. But query execution requires a connection to the database. But FilteredRowSet is disconnected. In case of JdbcRowSet filtering is done by sql query because it is always connected to the database.
For the filtering you have to create a Filter(implementing Predicative) first. Then use it in the RowSet.
Creating a Filter:
A filter is created by implementing javax.sql.rowset.Predicative interface.
And we have to override the evaluate() method.
Using filter in FilteredRowSet:
FilteredRowSet frs=new FilteredRowSetImpl();
Frs.populate(rs);

No comments:

Post a Comment