Path: blob/master/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/TransactionalWriter.java
40948 views
/*1* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sql.rowset.spi;2627import java.sql.SQLException;28import java.io.Reader;2930import javax.sql.RowSetWriter;31import javax.sql.rowset.*;32import java.sql.Savepoint;3334/**35* A specialized interface that facilitates an extension of the standard36* <code>SyncProvider</code> abstract class so that it has finer grained37* transaction control.38* <p>39* If one or more disconnected <code>RowSet</code> objects are participating40* in a global transaction, they may wish to coordinate their synchronization41* commits to preserve data integrity and reduce the number of42* synchronization exceptions. If this is the case, an application should set43* the <code>CachedRowSet</code> constant <code>COMMIT_ON_ACCEPT_CHANGES</code>44* to <code>false</code> and use the <code>commit</code> and <code>rollback</code>45* methods defined in this interface to manage transaction boundaries.46*47* @since 1.548*/49public interface TransactionalWriter extends RowSetWriter {5051/**52* Makes permanent all changes that have been performed by the53* <code>acceptChanges</code> method since the last call to either the54* <code>commit</code> or <code>rollback</code> methods.55* This method should be used only when auto-commit mode has been disabled.56*57* @throws SQLException if a database access error occurs or the58* <code>Connection</code> object within this <code>CachedRowSet</code>59* object is in auto-commit mode60*/61public void commit() throws SQLException;6263/**64* Undoes all changes made in the current transaction. This method should be65* used only when auto-commit mode has been disabled.66*67* @throws SQLException if a database access error occurs or the <code>Connection</code>68* object within this <code>CachedRowSet</code> object is in auto-commit mode69*/70public void rollback() throws SQLException;7172/**73* Undoes all changes made in the current transaction made prior to the given74* <code>Savepoint</code> object. This method should be used only when auto-commit75* mode has been disabled.76*77* @param s a <code>Savepoint</code> object marking a savepoint in the current78* transaction. All changes made before <i>s</i> was set will be undone.79* All changes made after <i>s</i> was set will be made permanent.80* @throws SQLException if a database access error occurs or the <code>Connection</code>81* object within this <code>CachedRowSet</code> object is in auto-commit mode82*/83public void rollback(Savepoint s) throws SQLException;84}858687