|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.rowset.internal.CachedRowSetWriter
public class CachedRowSetWriter
The facility called on internally by the RIOptimisticProvider implementation to
propagate changes back to the data source from which the rowset got its data.
A CachedRowSetWriter object, called a writer, has the public
method writeData for writing modified data to the underlying data source.
This method is invoked by the rowset internally and is never invoked directly by an application.
A writer also has public methods for setting and getting
the CachedRowSetReader object, called a reader, that is associated
with the writer. The remainder of the methods in this class are private and
are invoked internally, either directly or indirectly, by the method
writeData.
Typically the SyncFactory manages the RowSetReader and
the RowSetWriter implementations using SyncProvider objects.
Standard JDBC RowSet implementations provide an object instance of this
writer by invoking the SyncProvider.getRowSetWriter() method.
SyncProvider,
SyncFactory,
SyncFactoryException,
Serialized Form| Constructor Summary | |
|---|---|
CachedRowSetWriter()
|
|
| Method Summary | |
|---|---|
void |
commit()
Makes permanent all changes that have been performed by the acceptChanges method since the last call to either the
commit or rollback methods. |
CachedRowSetReader |
getReader()
Gets the reader for this writer. |
void |
rollback()
Undoes all changes made in the current transaction. |
void |
rollback(java.sql.Savepoint s)
Undoes all changes made in the current transaction made prior to the given Savepoint object. |
void |
setReader(CachedRowSetReader reader)
Sets the reader for this writer to the given reader. |
boolean |
writeData(javax.sql.RowSetInternal caller)
Propagates changes in the given RowSet object
back to its underlying data source and returns true
if successful. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CachedRowSetWriter()
| Method Detail |
|---|
public boolean writeData(javax.sql.RowSetInternal caller)
throws java.sql.SQLException
RowSet object
back to its underlying data source and returns true
if successful. The writer will check to see if
the data in the pre-modified rowset (the original values) differ
from the data in the underlying data source. If data in the data
source has been modified by someone else, there is a conflict,
and in that case, the writer will not write to the data source.
In other words, the writer uses an optimistic concurrency algorithm:
It checks for conflicts before making changes rather than restricting
access for concurrent users.
This method is called by the rowset internally when
the application invokes the method acceptChanges.
The writeData method in turn calls private methods that
it defines internally.
The following is a general summary of what the method
writeData does, much of which is accomplished
through calls to its own internal methods.
CachedRowSet object from the given
RowSet object
initSQLStatements to initialize new SQL statements
SELECT, UPDATE,
INSERT, and DELETE statements
CachedRowSet object's metadata to
determine the table name, column names, and the columns
that make up the primary key
CachedRowSet object back to its underlying data source
CachedRowSet object
to determine whether it has been updated, inserted, or deleted
CachedRowSet object, the writer will roll
back any changes it has made to the row in the data source.
writeData in interface javax.sql.RowSetWritertrue if changes to the rowset were successfully
written to the rowset's underlying data source;
false otherwise
java.sql.SQLException
public void setReader(CachedRowSetReader reader)
throws java.sql.SQLException
java.sql.SQLException - if a database access error occurs
public CachedRowSetReader getReader()
throws java.sql.SQLException
java.sql.SQLException - if a database access error occurs
public void commit()
throws java.sql.SQLException
TransactionalWriteracceptChanges method since the last call to either the
commit or rollback methods.
This method should be used only when auto-commit mode has been disabled.
commit in interface TransactionalWriterjava.sql.SQLException - if a database access error occurs or the
Connection object within this CachedRowSet
object is in auto-commit mode
public void rollback()
throws java.sql.SQLException
TransactionalWriter
rollback in interface TransactionalWriterjava.sql.SQLException - if a database access error occurs or the Connection
object within this CachedRowSet object is in auto-commit mode
public void rollback(java.sql.Savepoint s)
throws java.sql.SQLException
TransactionalWriterSavepoint object. This method should be used only when auto-commit
mode has been disabled.
rollback in interface TransactionalWriters - a Savepoint object marking a savepoint in the current
transaction. All changes made before s was set will be undone.
All changes made after s was set will be made permanent.
java.sql.SQLException - if a database access error occurs or the Connection
object within this CachedRowSet object is in auto-commit mode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||