Announcement

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

    com.isomorphic.base.UpdateWithoutPKException

    Hi Isomorphic,

    We are doing fetch operation which inturn calls an update operation.
    We face an issue while performing an update operation. The update query is formed with 2 criteria (The fields used in criteria is primary key).
    In the datasource file, we have specified "primary key = true" in the field definition.

    Datasource:

    <binding operationType="update" serverMethod="update">
    <serverObject lookupStyle="spring" bean="invoice" />
    <whereClause>
    ($defaultWhereClause)
    and reference = $advancedCriteria.ref
    and version = $advancedCriteria.ver
    </whereClause>
    </binding>

    <field name="reference" type="text" primaryKey="true"></field>
    <field name="version" type="int" primaryKey="true"></field>
    <field name="status" type="text"></title>

    code:

    DSRequest request = new DSRequest("testDs", "update",rpcManager);
    request.addToCriteria("ref",((String) dsRequest.getCriteriaValue("reference")));
    request.addToCriteria("ver",((String) dsRequest.getCriteriaValue("version")));
    request.execute();


    Error from Log:
    com.isomorphic.base.UpdateWithoutPKException: Criteria received from the client for update operation is missing the following required unique and/or primary fields: [reference,version]. Either provide all primary key fields or set allowMultiUpdate or providesMissingKeys on the OperationBinding (see the client-side docs for details of those flags

    Could you please help me to solve the issue.


    Thanks,
    Manjula
    Last edited by manjulam; 24 Aug 2020, 04:55.

    #2
    Your calls to addToCriteria use "ref" and "ver" whereas the field names are "reference" and "version".

    Comment


      #3
      But, it was working well before. we have implemented a new code before this functionality after that it is throwing the above exception.

      Please help me to get it solved.


      Thanks,
      Manjula
      Last edited by manjulam; 24 Aug 2020, 20:10.

      Comment


        #4
        Sorry, we don't understand what you mean.

        The server checks whether you have supplied values for all the PK fields. You haven't - you have supplied values for field names which are not the same as the PK fields. So this is incorrect, and the server is correctly reporting the error, just as designed.

        You just need to fix your code to use the correct field names.

        Also, this code would not have worked in other versions of SmartClient either, not unless you have other code involved which you haven't shown us.

        Comment

        Working...
        X