Skip to Content

Specified key for the new entity is a duplicate of an existing entity(Cloud Platform SDK for Android

Hi Team,

When we saving data to offline database it showing error "[-10103] The specified key for the new entity is a duplicate of an existing entity".

Note : Here data is saved in offline database and update to server. I am doing $batch request approach. I seen above error while doing debug mode .

I am doing single batch and single change set while doing processBatch();

Any thing missed let me know.

Sample Metadata :

<EntityType Name="CRMGenericStagingService" sap:content-version="1"> <Key> <PropertyRef Name="ServiceObject"/> <PropertyRef Name="DeviceId"/> <PropertyRef Name="RecordId"/> <PropertyRef Name="FieldName"/> </Key> <Property Name="ServiceObject" Type="Edm.String" Nullable="false" MaxLength="40" sap:label="Server Object" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/> <Property Name="DeviceId" Type="Edm.String" Nullable="false" MaxLength="40" sap:label="Device ID" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/> <Property Name="RecordId" Type="Edm.String" Nullable="false" MaxLength="15" sap:label="Record Id" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/> <Property Name="FieldName" Type="Edm.String" Nullable="false" MaxLength="40" sap:label="Help ValueFieldName" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/> <Property Name="FieldValue" Type="Edm.String" Nullable="false" sap:label="Field_value" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/> </EntityType>

We are following below link:

https://help.sap.com/doc/c2d571df73104f72b9f1b73e06c5609a/Latest/en-US/docs/user-guide/odata/Offline_OData_Modifying_Offline_Data.html

Regards

Ramakrishna. Amathi

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Nov 04, 2019 at 10:18 AM

    Hi Team,

    Issue is resolved. Problem is our code mistake. While creating batch request we called add.changes() method calling multiple times.

    Solution : add.changes() method should call only one time before create batch request.

    Regards

    Ramakrishna. Amathi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 11, 2019 at 01:27 PM

    Hi Team,

    Please help us.

    Regards

    Ramakrishna.Amathi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2019 at 10:37 AM

    Hi Team,

    Please update above comment.

    Regards

    Ramakrishna. Amathi

    Add a comment
    10|10000 characters needed characters exceeded