Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1815

das.applyChanges will always do insert instead of update if createDataObject was used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Java-DAS-beta1, Java-DAS-Next
    • Java-DAS-Next
    • Java DAS RDB
    • None
    • DB2 Iseries

    Description

      If I do something like:
      -------------------------------
      DataObject root = das.getCommand("AllAutos").executeQuery();

      DataObject dao = root.createDataObject("t_test");
      dao.set("NAME", "NICK");
      dao.set("ID", 100);

      das.applyChanges(root);
      -------------------------------------

      There is already a row in the table with primary key 100. ID is defined in the config xml as being the primary key, it ignores that ID was set and does an insert statement. ID is also defined as an auto generated column.

      Basically I was expecting something like Hibernate's savorOrUpdate... Maybe if the field that represents primary key is shown to have been changed in the changeSummary, then DAS will figure out what statement to generate.

      Where I'm seeing this being a problem is if we get a dataobject that represents a row in the database, and then send it off to a service, we get back another object that has been updated, but since it is a different object then the DAS will think it should do an update? Merge doesn't seem to alleviate this problem either. Please let me know if I am way off base here. Thanks

      Attachments

        1. 1815.patch
          40 kB
          Amita Vadhavkar

        Activity

          People

            amitav Amita Vadhavkar
            nick007vh Nick Duncan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: