The FilteredRowSet (javax.sql.FilteredRowSet) is a disconnected rowset, which enables you to retrieve a custom view of database data using a filter (filtering logic) that takes a snapshot of, but doesn’t alter, your table. The FilteredRowset interface extends the WebRowSet interface, which in turn extends the javax.sql.Rowset interface. The FilteredRowSet enables you to narrow down the number of rows in a disconnected object based on filtering logic you provide without requiring an ongoing connection to your database. How do you filter rowsets? You have at least two options:
The following is taken from the J2SE 5.0 documentation:
There are occasions when a RowSet object has a need to provide a degree of filtering to its contents. One possible solution is to provide a query language for all standard RowSet implementations; however, this is an impractical approach for lightweight components such as disconnected RowSet objects. The FilteredRowSet interface seeks to address this need without supplying a heavyweight query language along with the processing that such a query language would require. A JDBC FilteredRowSet standard implementation implements the RowSet interfaces and extends the CachedRowSet class. The CachedRowSet class provides a set of protected cursor manipulation methods, which a FilteredRowSet implementation can override to supply filtering support.
What is the Predicate interface? According to J2SE 5.0 documentation:
The Predicate interface is a standard interface that applications can implement to define the filter they wish to apply to a FilteredRowSet object. A FilteredRowSet object consumes implementations of this interface and enforces the constraints defined in the implementation of the method evaluate. A FilteredRowSet object enforces the filter constraints in a bi-directional manner: It outputs only rows that are within the constraints of the filter; and conversely, it inserts, modifies, or updates only rows that are within the constraints of the filter.
The Predicate interface has the following methods:
How does a FilteredRowSet object use a Predicate object? The FilteredRowSet interface has two specific methods for dealing with Predicate objects:
With some basic examples, I will show you how to use a FilteredRowSet object and set a simple filter for filtering rowsets.
MySQL Database Setup
Implementing Predicate
Using Predicate with a FilteredRowSet
Using a FilteredRowSet with a MySQL Database
JDBC Related Interview Questions |
|
---|---|
Core Java Interview Questions | JSP Interview Questions |
Java Servlets Interview Questions | EJB(Enterprise JavaBeans) Interview Questions |
JSTL(JSP Standard Tag Library) Interview Questions | JNDI (Java Naming and Directory Interface) Interview Questions |
Java Bean Utils Interview Questions | AWT (Abstract Window Toolkit) Interview Questions |
Jdbc Tutorial
What Is Jdbc Programming?
Database Metadata, Part 1
Database Metadata, Part 2
Resultset Metadata
Parameter Metadata
Exploring Driver Property Information
Rowset Metadata A
Web Access To Metadata,part 1
Web Access To Metadata, Part 2
Rdf And Jdbc Metadata
Text Resumes
Visual Resumes
Social Resumes
Resume Quality
IT Resume Samples
MARKETING Resume Samples
HR Resume Samples
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.