cancel
Showing results for 
Search instead for 
Did you mean: 

SAP cloud platform sdk for Android wizard, Offline Store exception

0 Kudos

Hi,

I’m facing problem with metadata here. earlier we used to declare group of defining queries/requests. my service url (metadata has duplicate entity type ex: customers & CUSTOMERS) because of this i’m getting offline store exception saying

Note : CUSTOMERS & Customers are replaced by some values.

com.sap.cloud.mobile.odata.offline.OfflineODataException: :1

EntityType Error: EntityType Name=’CUSTOMERS’ collides with EntityType Name=’Customers’. Each definition must have a unique name. You can use the ALLOW_CASE_CONFLICTS option to allow names differing only in case, but preferably the schema should be changed to avoid names differing only in case.
<EntityType Name=”CUSTOMERS” sap:content-version=”1″>…

at com.sap.cloud.mobile.odata.offline.internal.OfflineODataConverter.createOfflineODataException(OfflineODataConverter.java:111)

private void setupOfflineStore() {
  
    AndroidSystem.setContext(context);

    try {
        URL url = new URL(finalURL);
        OfflineODataParameters offParam = new OfflineODataParameters();
        offParam.setEnableRepeatableRequests(false);
        offlineODataProvider = new OfflineODataProvider(url, offParam,ClientProvider.get(), null, null);
      
        offlineODataProvider.addDefiningQuery(new OfflineODataDefiningQuery("CP", "CP", false));
    } catch (OfflineODataException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
   openOfflineStore();
}

above code I'm using as per tutorial.

In the above I've declared only one defining query 'CP' but, I'm getting error on different entity type. 
I've also setup an offline configuration to my application in Cockpit to allow case sensitive.

How to resolve this error?.

Thanks & Regards,
Hemanth.
View Entire Topic
Dan_vL
Product and Topic Expert
Product and Topic Expert

The following might be worth a try.

myOfflineDataProvider = new OfflineODataProvider(url, offParam, myOkHttpClient, null, null);
OfflineODataServiceOptions serviceOptions = new OfflineODataServiceOptions();
serviceOptions.setCsdlOptions(com.sap.cloud.mobile.odata.csdl.CsdlOption.ALLOW_CASE_CONFLICTS);
myOfflineDataProvider.setServiceOptions(serviceOptions);

Regards,
Dan van Leeuwen

0 Kudos

Works fine.!!

Thanks.