Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




Java Training: - Elaborate “ResultSet”, “RowSet”, “CachedRowset”, “JdbcRowset” and “WebRowSet” relation ship?

Below are the major points of difference:-

  • “ResultSet” is a connected architecture while “RowSet” is a disconnected architecture.
  • As “ResultSet” is a connected architecture we cannot serialize the object while “RowSet” can be serialized.
  • “RowSet” object is a Java bean while “ResultSet” is not. In the below diagram you can see “RowSet” interface also derives from “BaseRowSet” interface. “BaseRowSet” interface has all the ingredients to make it a Java bean.

Below diagram shows the complete relationship between all the interface and classes.

Figure: - Interface diagram for “Resultset” and “RowSet”

As "RowSet" is a disconnected from database it need to maintain Meta data for columns. "RowSet" can also provide scrollable resultsets or updatable resultsets even if the JDBC driver is not supporting the same. Java client can get a “RowSet” manipulate the same and finally send all the results to the database at one go. Sun has provided three implementation of “RowSet” as below:-

CachedRowSet: - Disconnected rowset always keeps the data in memory. It is scrollable and can also be serialized. It’s an ideal choice where we want to pass data between tiers or to do batch updates. "CachedRowSet" are disconnected so can be used for huge number of updates. Get the "CachedRowSet" object manipulate all your data and send the whole bunch of manipulated data in on go to the Database.

JDBCRowSet: - It’s opposite to "CachedRowSet". It maintains a connection to the database while the client has reference to it. So it’s a connected architecture as compared to CachedRowSet.

WebRowSet :- "WebRowSet" is a extension of "CachedRowSet". But the added feature is it can produce XML presentation of the data cached. If you are thinking of exposing your data through web services or to provide data to thin client which are written in different language other than JAVA. Best bet if you want to pass data in XML format over HTTP protocol.

See the following video on FlyWeight Pattern in Java: -

Click to get Java Training

Regards,

Get more Java Training from author’s blog

Share this article   |    Print    |    Article read by 6974 times
Author:
Shivprasad Koirala
We conduct training for Java/J2EE technologies like design patterns, J2EE, Struts, Hibernate, Spring, Rich Interface etc. and likes to write articles on the same in free time.
Related Articles:
Related Interview Questions: No related interview question