SyncResolver(javax.sql.rowset.spi.SyncResolver) is a “synchronized resolver” rowset , which extends the RowSet interface. According to the J2SE 5.0 documentation, SyncResolver
. . . defines a framework that allows applications to use a manual decision tree to decide what should be done when a synchronization conflict occurs. Although it is not mandatory for applications to resolve synchronization conflicts manually, this framework provides the means to delegate to the application when conflicts arise.Note that a conflict is a situation where the RowSet object’s original values for a row do not match the values in the data source, which indicates that the data source row has been modified since the last synchronization.Note also that a RowSet object’s original values are the values it had just prior to the last synchronization, which are not necessarily its initial values.
According to the J2SE 5.0 documentation, a SyncResolver object is a specialized RowSet object that implements the SyncResolver interface. It may operate as either a connected RowSet object (an implementation of the JdbcRowSet interface) or a disconnected RowSet object (an implementation of the CachedRowSet interface or one of its subinterfaces). The reference implementation for SyncResolver implements the CachedRowSet interface, but other implementations may choose to implement the JdbcRowSet interface to satisfy particular needs.
What is a synchronization conflict and when does it occur? When you change (update, insert, or delete) your RowSet object and you want to commit changes back to your data source, if there are problems, then these will be reported back to the client code. These problems are called “synchronization conflicts” (because you are trying to synchronize your rowset with data source data). Four types of conflicts (defined as static int) have been identified by the SyncResolver, and I have listed them here (for details on these types of conflicts, refer to the JDBC 3.0 Specification and consult the documentation for the driver you are working with):
According to the J2SE 5.0 documentation, the reference implementation provides a means by which an application can choose to resolve conflicts on a case-by-case basis. After the writer (a class that implements the RowSetWriter interface) finds all the conflicts, it throws a SyncProviderException object. An application can catch that exception and use it to create a SyncResolver object, a specialized kind of RowSet object. A SyncResolver object mirrors the RowSet object experiencing the conflicts, having the same number of rows and columns; however, it contains only the data that is in conflict. The SyncResolver object retrieves each conflict value in a row, comparing the value in the data source with the value in the RowSet object. After a decision is made as to which value should persist for each conflict in the row, the SyncResolver object sets those values with the method setResolvedValue. The SyncResolver object then goes to the next conflict and repeats the process until there are no more conflicts.
The following example (adapted from the J2SE 5.0 documentation) shows how to use a SyncResolver object:import javax.sql.rowSet.CachedRowSet;
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|
What Is Jdbc Programming?
Database Metadata, Part 1
Database Metadata, Part 2
Exploring Driver Property Information
Rowset Metadata A
Web Access To Metadata,part 1
Web Access To Metadata, Part 2
Rdf And Jdbc Metadata
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.