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. package javax.sql.rowset.spi;
  8. import java.sql.SQLException;
  9. import java.io.Reader;
  10. import javax.sql.RowSetWriter;
  11. import javax.sql.rowset.*;
  12. import java.sql.Savepoint;
  13. /**
  14. * A specialized interface that facilitates an extension of the standard
  15. * <code>SyncProvider</code> abstract class so that it has finer grained
  16. * transaction control.
  17. * <p>
  18. * If one or more disconnected <code>RowSet</code> objects are particating
  19. * in a global transaction, they may wish to coordinate their synchronization
  20. * commits to preserve data integrity and reduce the number of
  21. * sychronization exceptions. If this is the case, an application should set
  22. * the <code>CachedRowSet</code> constant <code>COMMIT_ON_ACCEPT_CHANGES</code>
  23. * to <code>false</code> and use the <code>commit</code> and <code>rollback</code>
  24. * methods defined in this interface to manage transaction boundaries.
  25. */
  26. public interface TransactionalWriter extends RowSetWriter {
  27. /**
  28. * Makes permanent all changes that have been performed by the
  29. * <code>acceptChanges</code> method since the last call to either the
  30. * <code>commit</code> or <code>rollback</code> methods.
  31. * This method should be used only when auto-commit mode has been disabled.
  32. *
  33. * @throws SQLException if a database access error occurs or the
  34. * <code>Connection</code> object within this <code>CachedRowSet</code>
  35. * object is in auto-commit mode
  36. */
  37. public void commit() throws SQLException;
  38. /**
  39. * Undoes all changes made in the current transaction. This method should be
  40. * used only when auto-commit mode has been disabled.
  41. *
  42. * @throws SQLException if a database access error occurs or the <code>Connection</code>
  43. * object within this <code>CachedRowSet</code> object is in auto-commit mode
  44. */
  45. public void rollback() throws SQLException;
  46. /**
  47. * Undoes all changes made in the current transaction made prior to the given
  48. * <code>Savepoint</code> object. This method should be used only when auto-commit
  49. * mode has been disabled.
  50. *
  51. * @param s a <code>Savepoint</code> object marking a savepoint in the current
  52. * transaction. All changes made before <i>s</i> was set will be undone.
  53. * All changes made after <i>s</i> was set will be made permanent.
  54. * @throws SQLException if a database access error occurs or the <code>Connection</code>
  55. * object within this <code>CachedRowSet</code> object is in auto-commit mode
  56. */
  57. public void rollback(Savepoint s) throws SQLException;
  58. }