C # provides a dataset that reads data from the data source into memory, operates offline, and then synchronizes to the data source. Similarly, a similar implementation, RowSet, is also provided in Java. Under the Javax.sql.rowset package, five different rowset interfaces are defined for use on different occasions. This article describes the use of these five RowSet, as well as detailed usage, and describes problems that may arise in use to remind readers to bypass these issues when they are actually in use.
RowSet Introduction
Javax.sql.rowset is introduced from JDK 1.4 and provides a reference implementation starting with JDK 5.0. It mainly includes Cachedrowset,webrowset,filteredrowset,joinrowset and Jdbcrowset. The remaining four are disconnected RowSet except that the Jdbcrowset remains connected to the data source.
Compared with Java.sql.ResultSet, RowSet off-line operation can effectively use the computer more and more sufficient memory, reduce the burden of the database server, because the data operations are in memory and then batch submitted to the data source, flexibility and performance has been greatly improved. RowSet default is a scrollable, updatable, serializable result set that, as a JavaBeans, can be easily transferred between networks for data synchronization at both ends.
Class inheritance Structure
RowSet inherits from ResultSet, and the other five RowSet interfaces inherit from RowSet. The following diagram is their inheritance relationship.
Figure 1. Inheritance structure diagram
Table 1. RowSet Interface Description
cachedrowset |
|
webrowset |
inherit from Cach Edrowset, you can write webrowset to an XML file, or you can populate Webrowset with an XML file that conforms to the specification. |
filteredrowset |
|
joinrowset |
|
jdbcrowset |
|