[J2SE 5.0 topic] New RowSet sub-interface

xiaoxiao2021-03-06  21

RowSet is an interface under the Javax.sql package, inherits from the ResultSet interface, is introduced in version 1.4. However, only such an interface is only lonely, JDK does not provide more subdivision categories. Let's take a look at what interest in javax.sql.rowset in version 5.0.

Inheritance relationship is probably:

ResultSet | - Rowset | - CachedRowSet | | - WebrowSet | | - FilteredRowSet | - JDBCROWSET | - SYNCRESOLVER

JDBCROWSET - Used to encapsulate JDBC results set; CachedRowSet - lightweight data containers, only when you need to read or write a database, other times, although you can modify / update it, but it's The database is disconnected, we can see WebrowSet, JoinRowSet, and FilteredRowSet are its sub-interface; FilteredRowSet - JoinRowSet - JoinRowSet - Implement SQL Join inquiry by instances of the class of multiple ROWSET interfaces; WebrowSet - use Standard XML format handles formalized data; SyncResolver - provides a frame / mechanism for processing synchronous conflicts. Using cachedrowset, and it defines a good sub-interface, as long as the JDBC driver gives a specific implementation, we can easily handle the asynchronous data object, only the database connection is performed when needed, and there are many resources. Take up. Basically, what you need to do is give the connection parameters and SQL statements, the result returned, and then submit the changes to the data source, and the specific details are packaged. For those who have just contacted JDBC, I want to say, although you see an interface, but this is the characteristics and advantages of JDBC, and the JDBC API designer defines the interface (with its function). Like a paper contract, a specific database vendor or a third party follows this contract to implement these interfaces, and for the one who uses JDBC, it can be assured to define a good method according to the contract call, but don't worry that these methods are not Existent or has no implementation. Even if we have changed the database, we are faced or those APIs, as long as the new database also has such a set of JDBC drivers. (Realmonic projects are more difficult, but this is another matter.) This is the essence of interface programming. Go back to our Rowset new krigting interface, the purpose of which is the same as a set of standard behaviors, so that the specific JDBC provider is implemented, we use it directly on the other end. More detailed content, refer to here.

转载请注明原文地址:https://www.9cbs.com/read-39796.html

New Post(0)