Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6423898

DataSet cannot be modified in connected mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • core-libs
    • None
    • b91
    • generic
    • generic
    • Verified

      While trying to update rows using a DataSet the following exception appears :

      java.sql.SQLRuntimeException: DataSet cannot be modified.

      Using build 80 of mustang and today's official Trondheim build of the Derby trunk.

      Code :

       Here's the method that's doing the updating:

          /**
            * Updates a list of addresses using DataSet
            */
          public void updateAddresses()
              throws SQLException {
              AddressQueryIdSubset aq =
                      con.createQueryObject(AddressQueryIdSubset.class);
              DataSet<Address> addresses = aq.getAddresses();
              if (addresses.isReadOnly())
                  throw new SQLException("DataSet is readOnly!");
              for (Address val : addresses) {
                  val.setCity("Davis");
                  addresses.modify(); // [Exception thrown here]
              }
              aq.close();
          }

       And here's the query interface:

       public interface AddressQueryIdSubset extends BaseQuery {

          @Select(readOnly=false,
                  sql="SELECT addrid, street, city, state, zipcode, country"
                 + " FROM addresses WHERE datastore_identity < 5")
          DataSet<Address> getAddresses();
       }

            ssharmasunw Sushmita Sharma (Inactive)
            ssharmasunw Sushmita Sharma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: