KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sql > rowset > spi > TransactionalWriter


1 /*
2  * @(#)TransactionalWriter.java 1.3 04/02/27
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.sql.rowset.spi;
9
10 import java.sql.SQLException JavaDoc;
11 import java.io.Reader JavaDoc;
12
13 import javax.sql.RowSetWriter JavaDoc;
14 import javax.sql.rowset.*;
15 import java.sql.Savepoint JavaDoc;
16
17 /**
18  * A specialized interface that facilitates an extension of the standard
19  * <code>SyncProvider</code> abstract class so that it has finer grained
20  * transaction control.
21  * <p>
22  * If one or more disconnected <code>RowSet</code> objects are particating
23  * in a global transaction, they may wish to coordinate their synchronization
24  * commits to preserve data integrity and reduce the number of
25  * sychronization exceptions. If this is the case, an application should set
26  * the <code>CachedRowSet</code> constant <code>COMMIT_ON_ACCEPT_CHANGES</code>
27  * to <code>false</code> and use the <code>commit</code> and <code>rollback</code>
28  * methods defined in this interface to manage transaction boundaries.
29  */

30 public interface TransactionalWriter extends RowSetWriter JavaDoc {
31     
32     /**
33      * Makes permanent all changes that have been performed by the
34      * <code>acceptChanges</code> method since the last call to either the
35      * <code>commit</code> or <code>rollback</code> methods.
36      * This method should be used only when auto-commit mode has been disabled.
37      *
38      * @throws SQLException if a database access error occurs or the
39      * <code>Connection</code> object within this <code>CachedRowSet</code>
40      * object is in auto-commit mode
41      */

42     public void commit() throws SQLException JavaDoc;
43     
44     /**
45      * Undoes all changes made in the current transaction. This method should be
46      * used only when auto-commit mode has been disabled.
47      *
48      * @throws SQLException if a database access error occurs or the <code>Connection</code>
49      * object within this <code>CachedRowSet</code> object is in auto-commit mode
50      */

51     public void rollback() throws SQLException JavaDoc;
52     
53     /**
54      * Undoes all changes made in the current transaction made prior to the given
55      * <code>Savepoint</code> object. This method should be used only when auto-commit
56      * mode has been disabled.
57      *
58      * @param s a <code>Savepoint</code> object marking a savepoint in the current
59      * transaction. All changes made before <i>s</i> was set will be undone.
60      * All changes made after <i>s</i> was set will be made permanent.
61      * @throws SQLException if a database access error occurs or the <code>Connection</code>
62      * object within this <code>CachedRowSet</code> object is in auto-commit mode
63      */

64     public void rollback(Savepoint JavaDoc s) throws SQLException JavaDoc;
65 }
66
Popular Tags