Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-594

SQL ConstraintViolationException when updating the list node element using PATCH List node API

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Medium
    • Resolution: Done
    • Istanbul Release
    • Jakarta Release
    • CPS-Core
    • None

    Description

      List Node PATCH Endpoint is expected to replace all the list Node elements, but it fails if existing and new list node element has the same XPath.

      Steps to reproduce:
      1. Create a bookstore object using PUT nodes API

      endpoint: /cps/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes?xpath=/
      body: 
      {
          "test:bookstore": {
              "bookstore-name": "Chapters1",
              "categories": [
                  {
                      "code": "01",
                      "name": "SciFi"
                  }
              ]
          }
      }
      

      2. Update the categories using PATCH list nodes API

      endpoint: /cps/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-node?xpath=/bookstore
      body: 
      {
          "categories": [
               {
                  "code": "01",
                  "name": "SciFi-new"
               },
               {
                  "name": "kids2",
                  "code": "02"
               }
            ]
      }
      

      Expected Response-> The list node should get updated without error
      Actual Response -> Received below error

      {
          "status": "500 INTERNAL_SERVER_ERROR",
          "message": "could not execute statement; SQL [n/a]; constraint [fragment_dataspace_id_anchor_id_xpath_key]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement",
          "details": "Check logs for details."
      }
      

       

      Root cause:
      The suspected root cause is explained here CPS-501

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              DylanB95EST Dylan Byrne
              renukumari Renu Kumari
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: