src/share/classes/javax/sql/rowset/CachedRowSet.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 import javax.sql.*;
  30 import javax.naming.*;
  31 import java.io.*;
  32 import java.math.*;
  33 import java.util.*;
  34 
  35 import javax.sql.rowset.spi.*;
  36 
  37 /**
  38  * The interface that all standard implementations of
  39  * <code>CachedRowSet</code> must implement.
  40  * <P>
  41  * The reference implementation of the <code>CachedRowSet</code> interface provided
  42  * by Oracle Corporation is a standard implementation. Developers may use this implementation
  43  * just as it is, they may extend it, or they may choose to write their own implementations
  44  * of this interface.
  45  * <P>
  46  * A <code>CachedRowSet</code> object is a container for rows of data
  47  * that caches its rows in memory, which makes it possible to operate without always being
  48  * connected to its data source. Further, it is a
  49  * JavaBeans<sup><font size=-2>TM</font></sup> component and is scrollable,
  50  * updatable, and serializable. A <code>CachedRowSet</code> object typically
  51  * contains rows from a result set, but it can also contain rows from any file
  52  * with a tabular format, such as a spread sheet.  The reference implementation
  53  * supports getting data only from a <code>ResultSet</code> object, but
  54  * developers can extend the <code>SyncProvider</code> implementations to provide
  55  * access to other tabular data sources.
  56  * <P>
  57  * An application can modify the data in a <code>CachedRowSet</code> object, and
  58  * those modifications can then be propagated back to the source of the data.
  59  * <P>
  60  * A <code>CachedRowSet</code> object is a <i>disconnected</i> rowset, which means
  61  * that it makes use of a connection to its data source only briefly. It connects to its
  62  * data source while it is reading data to populate itself with rows and again
  63  * while it is propagating changes back to its underlying data source. The rest
  64  * of the time, a <code>CachedRowSet</code> object is disconnected, including
  65  * while its data is being modified. Being disconnected makes a <code>RowSet</code>
  66  * object much leaner and therefore much easier to pass to another component.  For
  67  * example, a disconnected <code>RowSet</code> object can be serialized and passed
  68  * over the wire to a thin client such as a personal digital assistant (PDA).
  69  * <P>


 393  * <P>
 394  * <h3>9.0 Setting Properties</h3>
 395  * All rowsets maintain a set of properties, which will usually be set using
 396  * a tool.  The number and kinds of properties a rowset has will vary,
 397  * depending on what the rowset does and how it gets its data.  For example,
 398  * rowsets that get their data from a <code>ResultSet</code> object need to
 399  * set the properties that are required for making a database connection.
 400  * If a rowset uses the <code>DriverManager</code> facility to make a
 401  * connection, it needs to set a property for the JDBC URL that identifies
 402  * the appropriate driver, and it needs to set the properties that give the
 403  * user name and password.
 404  * If, on the other hand, the rowset uses a <code>DataSource</code> object
 405  * to make the connection, which is the preferred method, it does not need to
 406  * set the property for the JDBC URL.  Instead, it needs to set
 407  * properties for the logical name of the data source, for the user name,
 408  * and for the password.
 409  * <P>
 410  * NOTE:  In order to use a <code>DataSource</code> object for making a
 411  * connection, the <code>DataSource</code> object must have been registered
 412  * with a naming service that uses the Java Naming and Directory
 413  * Interface<sup><font size=-2>TM</font></sup> (JNDI) API.  This registration
 414  * is usually done by a person acting in the capacity of a system
 415  * administrator.
 416  * <P>
 417  * In order to be able to populate itself with data from a database, a rowset
 418  * needs to set a command property.  This property is a query that is a
 419  * <code>PreparedStatement</code> object, which allows the query to have
 420  * parameter placeholders that are set at run time, as opposed to design time.
 421  * To set these placeholder parameters with values, a rowset provides
 422  * setter methods for setting values of each data type,
 423  * similar to the setter methods provided by the <code>PreparedStatement</code>
 424  * interface.
 425  * <P>
 426  * The following code fragment illustrates how the <code>CachedRowSet</code>
 427  * object <code>crs</code> might have its command property set.  Note that if a
 428  * tool is used to set properties, this is the code that the tool would use.
 429  * <PRE>{@code
 430  *    crs.setCommand("SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS " +
 431  *                   "WHERE CREDIT_LIMIT > ? AND REGION = ?");
 432  * } </PRE>
 433  * <P>


 717     * After all conflicts have been resolved, an application must call the
 718     * <code>acceptChanges</code> method again to write resolved values to the
 719     * data source.  If all of the values in the data source are already the
 720     * values to be persisted, the method <code>acceptChanges</code> does nothing.
 721     * <P>
 722     * Some provider implementations may use locks to ensure that there are no
 723     * conflicts.  In such cases, it is guaranteed that the writer will succeed in
 724     * writing changes to the data source when the method <code>acceptChanges</code>
 725     * is called.  This method may be called immediately after the methods
 726     * <code>updateRow</code>, <code>insertRow</code>, or <code>deleteRow</code>
 727     * have been called, but it is more efficient to call it only once after
 728     * all changes have been made so that only one connection needs to be
 729     * established.
 730     * <P>
 731     * Note: The <code>acceptChanges()</code> method will determine if the
 732     * <code>COMMIT_ON_ACCEPT_CHANGES</code> is set to true or not. If it is set
 733     * to true, all updates in the synchronization are committed to the data
 734     * source. Otherwise, the application <b>must</b> explicity call the
 735     * <code>commit()</code> or <code>rollback()</code> methods as appropriate.
 736     *
 737     * @throws SQLException if the cursor is on the insert row
 738     * @throws SyncProviderException if the underlying
 739     * synchronization provider's writer fails to write the updates
 740     * back to the data source
 741     * @see #acceptChanges(java.sql.Connection)
 742     * @see javax.sql.RowSetWriter
 743     * @see javax.sql.rowset.spi.SyncFactory
 744     * @see javax.sql.rowset.spi.SyncProvider
 745     * @see javax.sql.rowset.spi.SyncProviderException
 746     * @see javax.sql.rowset.spi.SyncResolver
 747     */
 748     public void acceptChanges() throws SyncProviderException;
 749 
 750    /**
 751     * Propagates all row update, insert and delete changes to the
 752     * data source backing this <code>CachedRowSet</code> object
 753     * using the specified <code>Connection</code> object to establish a
 754     * connection to the data source.
 755     * <P>
 756     * The other version of the <code>acceptChanges</code> method is not passed
 757     * a connection because it uses


 788     * <code>acceptChanges</code> method again to write resolved values to the
 789     * data source.  If all of the values in the data source are already the
 790     * values to be persisted, the method <code>acceptChanges</code> does nothing.
 791     * <P>
 792     * Some provider implementations may use locks to ensure that there are no
 793     * conflicts.  In such cases, it is guaranteed that the writer will succeed in
 794     * writing changes to the data source when the method <code>acceptChanges</code>
 795     * is called.  This method may be called immediately after the methods
 796     * <code>updateRow</code>, <code>insertRow</code>, or <code>deleteRow</code>
 797     * have been called, but it is more efficient to call it only once after
 798     * all changes have been made so that only one connection needs to be
 799     * established.
 800     * <P>
 801     * Note: The <code>acceptChanges()</code> method will determine if the
 802     * <code>COMMIT_ON_ACCEPT_CHANGES</code> is set to true or not. If it is set
 803     * to true, all updates in the synchronization are committed to the data
 804     * source. Otherwise, the application <b>must</b> explicity call the
 805     * <code>commit</code> or <code>rollback</code> methods as appropriate.
 806     *
 807     * @param con a standard JDBC <code>Connection</code> object
 808     * @throws SQLException if the cursor is on the insert row
 809     * @throws SyncProviderException if the underlying
 810     * synchronization provider's writer fails to write the updates
 811     * back to the data source
 812     * @see #acceptChanges()
 813     * @see javax.sql.RowSetWriter
 814     * @see javax.sql.rowset.spi.SyncFactory
 815     * @see javax.sql.rowset.spi.SyncProvider
 816     * @see javax.sql.rowset.spi.SyncProviderException
 817     * @see javax.sql.rowset.spi.SyncResolver
 818     */
 819     public void acceptChanges(Connection con) throws SyncProviderException;
 820 
 821    /**
 822     * Restores this <code>CachedRowSet</code> object to its original
 823     * value, that is, its value before the last set of changes. If there
 824     * have been no changes to the rowset or only one set of changes,
 825     * the original value is the value with which this <code>CachedRowSet</code> object
 826     * was populated; otherwise, the original value is
 827     * the value it had immediately before its current value.
 828     * <P>


1354     * @see javax.sql.RowSetEvent
1355     * @see javax.sql.RowSetListener
1356     */
1357     public CachedRowSet createCopy() throws SQLException;
1358 
1359     /**
1360      * Creates a <code>CachedRowSet</code> object that is an empty copy of this
1361      * <code>CachedRowSet</code> object.  The copy
1362      * must not contain any contents but only represent the table
1363      * structure of the original <code>CachedRowSet</code> object. In addition, primary
1364      * or foreign key constraints set in the originating <code>CachedRowSet</code> object must
1365      * be equally enforced in the new empty <code>CachedRowSet</code> object.
1366      * In contrast to
1367      * the <code>RowSet</code> object generated from a <code>createShared</code> method
1368      * call, updates made to a copy of this <code>CachedRowSet</code> object with the
1369      * <code>createCopySchema</code> method must not be visible to it.
1370      * <P>
1371      * Applications can form a <code>WebRowSet</code> object from the <code>CachedRowSet</code>
1372      * object returned by this method in order
1373      * to export the <code>RowSet</code> schema definition to XML for future use.
1374      *
1375      * @throws SQLException if an error occurs in cloning the structure of this
1376      *         <code>CachedRowSet</code> object
1377      * @see #createShared
1378      * @see #createCopySchema
1379      * @see #createCopyNoConstraints
1380      * @see javax.sql.RowSetEvent
1381      * @see javax.sql.RowSetListener
1382      */
1383     public CachedRowSet createCopySchema() throws SQLException;
1384 
1385     /**
1386      * Creates a <code>CachedRowSet</code> object that is a deep copy of
1387      * this <code>CachedRowSet</code> object's data but is independent of it.
1388      * In contrast to
1389      * the <code>RowSet</code> object generated from a <code>createShared</code>
1390      * method call, updates made to a copy of this <code>CachedRowSet</code> object
1391      * must not be visible to it. Also, any
1392      * event listeners that are registered with this
1393      * <code>CachedRowSet</code> object must not have scope over the new
1394      * <code>RowSet</code> object. In addition, any constraint restrictions


1526      * @deprecated Because this field is final (it is part of an interface),
1527      *  its value cannot be changed.
1528      * @see #commit
1529      * @see #rollback
1530      */
1531     @Deprecated
1532     public static final boolean COMMIT_ON_ACCEPT_CHANGES = true;
1533 
1534     /**
1535      * Notifies registered listeners that a RowSet object in the given RowSetEvent
1536      * object has populated a number of additional rows. The <code>numRows</code> parameter
1537      * ensures that this event will only be fired every <code>numRow</code>.
1538      * <p>
1539      * The source of the event can be retrieved with the method event.getSource.
1540      *
1541      * @param event a <code>RowSetEvent</code> object that contains the
1542      *     <code>RowSet</code> object that is the source of the events
1543      * @param numRows when populating, the number of rows interval on which the
1544      *     <code>CachedRowSet</code> populated should fire; the default value
1545      *     is zero; cannot be less than <code>fetchSize</code> or zero

1546      */
1547     public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException;
1548 
1549     /**
1550      * Populates this <code>CachedRowSet</code> object with data from
1551      * the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code>
1552      * method, an additional parameter is provided to allow starting position within
1553      * the <code>ResultSet</code> from where to populate the CachedRowSet
1554      * instance.
1555      * <P>
1556      * This method can be used as an alternative to the <code>execute</code> method when an
1557      * application has a connection to an open <code>ResultSet</code> object.
1558      * Using the method <code>populate</code> can be more efficient than using
1559      * the version of the <code>execute</code> method that takes no parameters
1560      * because it does not open a new connection and re-execute this
1561      * <code>CachedRowSet</code> object's command. Using the <code>populate</code>
1562      *  method is more a matter of convenience when compared to using the version
1563      * of <code>execute</code> that takes a <code>ResultSet</code> object.
1564      *
1565      * @param startRow the position in the <code>ResultSet</code> from where to start


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 import javax.sql.*;
  30 import javax.naming.*;
  31 import java.io.*;
  32 import java.math.*;
  33 import java.util.*;
  34 
  35 import javax.sql.rowset.spi.*;
  36 
  37 /**
  38  * The interface that all standard implementations of
  39  * <code>CachedRowSet</code> must implement.
  40  * <P>
  41  * The reference implementation of the <code>CachedRowSet</code> interface provided
  42  * by Oracle Corporation is a standard implementation. Developers may use this implementation
  43  * just as it is, they may extend it, or they may choose to write their own implementations
  44  * of this interface.
  45  * <P>
  46  * A <code>CachedRowSet</code> object is a container for rows of data
  47  * that caches its rows in memory, which makes it possible to operate without always being
  48  * connected to its data source. Further, it is a
  49  * JavaBeans&trade; component and is scrollable,
  50  * updatable, and serializable. A <code>CachedRowSet</code> object typically
  51  * contains rows from a result set, but it can also contain rows from any file
  52  * with a tabular format, such as a spread sheet.  The reference implementation
  53  * supports getting data only from a <code>ResultSet</code> object, but
  54  * developers can extend the <code>SyncProvider</code> implementations to provide
  55  * access to other tabular data sources.
  56  * <P>
  57  * An application can modify the data in a <code>CachedRowSet</code> object, and
  58  * those modifications can then be propagated back to the source of the data.
  59  * <P>
  60  * A <code>CachedRowSet</code> object is a <i>disconnected</i> rowset, which means
  61  * that it makes use of a connection to its data source only briefly. It connects to its
  62  * data source while it is reading data to populate itself with rows and again
  63  * while it is propagating changes back to its underlying data source. The rest
  64  * of the time, a <code>CachedRowSet</code> object is disconnected, including
  65  * while its data is being modified. Being disconnected makes a <code>RowSet</code>
  66  * object much leaner and therefore much easier to pass to another component.  For
  67  * example, a disconnected <code>RowSet</code> object can be serialized and passed
  68  * over the wire to a thin client such as a personal digital assistant (PDA).
  69  * <P>


 393  * <P>
 394  * <h3>9.0 Setting Properties</h3>
 395  * All rowsets maintain a set of properties, which will usually be set using
 396  * a tool.  The number and kinds of properties a rowset has will vary,
 397  * depending on what the rowset does and how it gets its data.  For example,
 398  * rowsets that get their data from a <code>ResultSet</code> object need to
 399  * set the properties that are required for making a database connection.
 400  * If a rowset uses the <code>DriverManager</code> facility to make a
 401  * connection, it needs to set a property for the JDBC URL that identifies
 402  * the appropriate driver, and it needs to set the properties that give the
 403  * user name and password.
 404  * If, on the other hand, the rowset uses a <code>DataSource</code> object
 405  * to make the connection, which is the preferred method, it does not need to
 406  * set the property for the JDBC URL.  Instead, it needs to set
 407  * properties for the logical name of the data source, for the user name,
 408  * and for the password.
 409  * <P>
 410  * NOTE:  In order to use a <code>DataSource</code> object for making a
 411  * connection, the <code>DataSource</code> object must have been registered
 412  * with a naming service that uses the Java Naming and Directory
 413  * Interface&trade; (JNDI) API.  This registration
 414  * is usually done by a person acting in the capacity of a system
 415  * administrator.
 416  * <P>
 417  * In order to be able to populate itself with data from a database, a rowset
 418  * needs to set a command property.  This property is a query that is a
 419  * <code>PreparedStatement</code> object, which allows the query to have
 420  * parameter placeholders that are set at run time, as opposed to design time.
 421  * To set these placeholder parameters with values, a rowset provides
 422  * setter methods for setting values of each data type,
 423  * similar to the setter methods provided by the <code>PreparedStatement</code>
 424  * interface.
 425  * <P>
 426  * The following code fragment illustrates how the <code>CachedRowSet</code>
 427  * object <code>crs</code> might have its command property set.  Note that if a
 428  * tool is used to set properties, this is the code that the tool would use.
 429  * <PRE>{@code
 430  *    crs.setCommand("SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS " +
 431  *                   "WHERE CREDIT_LIMIT > ? AND REGION = ?");
 432  * } </PRE>
 433  * <P>


 717     * After all conflicts have been resolved, an application must call the
 718     * <code>acceptChanges</code> method again to write resolved values to the
 719     * data source.  If all of the values in the data source are already the
 720     * values to be persisted, the method <code>acceptChanges</code> does nothing.
 721     * <P>
 722     * Some provider implementations may use locks to ensure that there are no
 723     * conflicts.  In such cases, it is guaranteed that the writer will succeed in
 724     * writing changes to the data source when the method <code>acceptChanges</code>
 725     * is called.  This method may be called immediately after the methods
 726     * <code>updateRow</code>, <code>insertRow</code>, or <code>deleteRow</code>
 727     * have been called, but it is more efficient to call it only once after
 728     * all changes have been made so that only one connection needs to be
 729     * established.
 730     * <P>
 731     * Note: The <code>acceptChanges()</code> method will determine if the
 732     * <code>COMMIT_ON_ACCEPT_CHANGES</code> is set to true or not. If it is set
 733     * to true, all updates in the synchronization are committed to the data
 734     * source. Otherwise, the application <b>must</b> explicity call the
 735     * <code>commit()</code> or <code>rollback()</code> methods as appropriate.
 736     *

 737     * @throws SyncProviderException if the underlying
 738     * synchronization provider's writer fails to write the updates
 739     * back to the data source
 740     * @see #acceptChanges(java.sql.Connection)
 741     * @see javax.sql.RowSetWriter
 742     * @see javax.sql.rowset.spi.SyncFactory
 743     * @see javax.sql.rowset.spi.SyncProvider
 744     * @see javax.sql.rowset.spi.SyncProviderException
 745     * @see javax.sql.rowset.spi.SyncResolver
 746     */
 747     public void acceptChanges() throws SyncProviderException;
 748 
 749    /**
 750     * Propagates all row update, insert and delete changes to the
 751     * data source backing this <code>CachedRowSet</code> object
 752     * using the specified <code>Connection</code> object to establish a
 753     * connection to the data source.
 754     * <P>
 755     * The other version of the <code>acceptChanges</code> method is not passed
 756     * a connection because it uses


 787     * <code>acceptChanges</code> method again to write resolved values to the
 788     * data source.  If all of the values in the data source are already the
 789     * values to be persisted, the method <code>acceptChanges</code> does nothing.
 790     * <P>
 791     * Some provider implementations may use locks to ensure that there are no
 792     * conflicts.  In such cases, it is guaranteed that the writer will succeed in
 793     * writing changes to the data source when the method <code>acceptChanges</code>
 794     * is called.  This method may be called immediately after the methods
 795     * <code>updateRow</code>, <code>insertRow</code>, or <code>deleteRow</code>
 796     * have been called, but it is more efficient to call it only once after
 797     * all changes have been made so that only one connection needs to be
 798     * established.
 799     * <P>
 800     * Note: The <code>acceptChanges()</code> method will determine if the
 801     * <code>COMMIT_ON_ACCEPT_CHANGES</code> is set to true or not. If it is set
 802     * to true, all updates in the synchronization are committed to the data
 803     * source. Otherwise, the application <b>must</b> explicity call the
 804     * <code>commit</code> or <code>rollback</code> methods as appropriate.
 805     *
 806     * @param con a standard JDBC <code>Connection</code> object

 807     * @throws SyncProviderException if the underlying
 808     * synchronization provider's writer fails to write the updates
 809     * back to the data source
 810     * @see #acceptChanges()
 811     * @see javax.sql.RowSetWriter
 812     * @see javax.sql.rowset.spi.SyncFactory
 813     * @see javax.sql.rowset.spi.SyncProvider
 814     * @see javax.sql.rowset.spi.SyncProviderException
 815     * @see javax.sql.rowset.spi.SyncResolver
 816     */
 817     public void acceptChanges(Connection con) throws SyncProviderException;
 818 
 819    /**
 820     * Restores this <code>CachedRowSet</code> object to its original
 821     * value, that is, its value before the last set of changes. If there
 822     * have been no changes to the rowset or only one set of changes,
 823     * the original value is the value with which this <code>CachedRowSet</code> object
 824     * was populated; otherwise, the original value is
 825     * the value it had immediately before its current value.
 826     * <P>


1352     * @see javax.sql.RowSetEvent
1353     * @see javax.sql.RowSetListener
1354     */
1355     public CachedRowSet createCopy() throws SQLException;
1356 
1357     /**
1358      * Creates a <code>CachedRowSet</code> object that is an empty copy of this
1359      * <code>CachedRowSet</code> object.  The copy
1360      * must not contain any contents but only represent the table
1361      * structure of the original <code>CachedRowSet</code> object. In addition, primary
1362      * or foreign key constraints set in the originating <code>CachedRowSet</code> object must
1363      * be equally enforced in the new empty <code>CachedRowSet</code> object.
1364      * In contrast to
1365      * the <code>RowSet</code> object generated from a <code>createShared</code> method
1366      * call, updates made to a copy of this <code>CachedRowSet</code> object with the
1367      * <code>createCopySchema</code> method must not be visible to it.
1368      * <P>
1369      * Applications can form a <code>WebRowSet</code> object from the <code>CachedRowSet</code>
1370      * object returned by this method in order
1371      * to export the <code>RowSet</code> schema definition to XML for future use.
1372      * @return An empty copy of this {@code CachedRowSet} object
1373      * @throws SQLException if an error occurs in cloning the structure of this
1374      *         <code>CachedRowSet</code> object
1375      * @see #createShared
1376      * @see #createCopySchema
1377      * @see #createCopyNoConstraints
1378      * @see javax.sql.RowSetEvent
1379      * @see javax.sql.RowSetListener
1380      */
1381     public CachedRowSet createCopySchema() throws SQLException;
1382 
1383     /**
1384      * Creates a <code>CachedRowSet</code> object that is a deep copy of
1385      * this <code>CachedRowSet</code> object's data but is independent of it.
1386      * In contrast to
1387      * the <code>RowSet</code> object generated from a <code>createShared</code>
1388      * method call, updates made to a copy of this <code>CachedRowSet</code> object
1389      * must not be visible to it. Also, any
1390      * event listeners that are registered with this
1391      * <code>CachedRowSet</code> object must not have scope over the new
1392      * <code>RowSet</code> object. In addition, any constraint restrictions


1524      * @deprecated Because this field is final (it is part of an interface),
1525      *  its value cannot be changed.
1526      * @see #commit
1527      * @see #rollback
1528      */
1529     @Deprecated
1530     public static final boolean COMMIT_ON_ACCEPT_CHANGES = true;
1531 
1532     /**
1533      * Notifies registered listeners that a RowSet object in the given RowSetEvent
1534      * object has populated a number of additional rows. The <code>numRows</code> parameter
1535      * ensures that this event will only be fired every <code>numRow</code>.
1536      * <p>
1537      * The source of the event can be retrieved with the method event.getSource.
1538      *
1539      * @param event a <code>RowSetEvent</code> object that contains the
1540      *     <code>RowSet</code> object that is the source of the events
1541      * @param numRows when populating, the number of rows interval on which the
1542      *     <code>CachedRowSet</code> populated should fire; the default value
1543      *     is zero; cannot be less than <code>fetchSize</code> or zero
1544      * @throws SQLException {@code numRows < 0 or numRows < getFetchSize() }
1545      */
1546     public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException;
1547 
1548     /**
1549      * Populates this <code>CachedRowSet</code> object with data from
1550      * the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code>
1551      * method, an additional parameter is provided to allow starting position within
1552      * the <code>ResultSet</code> from where to populate the CachedRowSet
1553      * instance.
1554      * <P>
1555      * This method can be used as an alternative to the <code>execute</code> method when an
1556      * application has a connection to an open <code>ResultSet</code> object.
1557      * Using the method <code>populate</code> can be more efficient than using
1558      * the version of the <code>execute</code> method that takes no parameters
1559      * because it does not open a new connection and re-execute this
1560      * <code>CachedRowSet</code> object's command. Using the <code>populate</code>
1561      *  method is more a matter of convenience when compared to using the version
1562      * of <code>execute</code> that takes a <code>ResultSet</code> object.
1563      *
1564      * @param startRow the position in the <code>ResultSet</code> from where to start