Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    update with List of PKs

    Hi, I just noticed another change in behaviour in the more recent builds of 13.1. Previously, code like this:

    Code:
     DSRequest dsRequest = new DSRequest("myDS", DataSource.OP_UPDATE, rpcManager);
            dsRequest.setCriteria(DataTools.buildMap("pk",DataTools.buildList(1, 2, 3));
            dsRequest.setValues(values);
            DSResponse dsResponse = dsRequest.execute();
    worked even with `allowMultiUpdate=false`, whereas now it says that the primary key is missing and I must provide it or set allowMultiUpdate.

    Is it a bug, or was this type of code not allowed?
    Last edited by claudiobosticco; 24 Mar 2025, 11:59.

    #2
    Are you saying this is happening with a server-created DSRequest? If so, are you explicitly setting allowMultiUpdate(false) on the request? multiUpdates of any kind are supposed to be allowed on server-created requests. If this is coming from a client-created request, or a server-created request that you have explicitly marked as not allowMultiUpdate, that makes sense: we recently tightened up the rules around primaryKeys when validating "update" and "remove" requests originating on the client. The intent has always been that those operations should only be allowed if they are affecting a single row - ie, the criteria contains a single primaryKey value.


    We regard the previous behavior (that you outline above) as a bug that has now been fixed. However, if you really need the old behavior back, there is a backcompat flag you can set in server.properties:

    Code:
    allowMultiPKUpdates: true

    Comment


      #3
      Hello, this is happening in a piece of code similar to the one in the first post, where allowMultiUpdate is not set (so it's false), and I'm using rpcManager to create the DSRequest.

      As a result, it behaves like a client request, and I understand that this type of update is no longer allowed.

      In fact, it only works if I set allowMultiUpdate to true or if I don’t use/pass rpcManager in the DSRequest.

      I should review my code to determine whether I actually need to use the backcompat flag, but I’ve tried it and it doesn’t seem to have any effect. Is the name allowMultiPKUpdates correct?

      Comment

      Working...
      X