Skip to Content

SAP cloud platform sdk for Android wizard, Offline Store exception

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.
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Feb 11 at 05:43 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 04 at 04:09 PM

    One suggestion would be to try this with the 2.0 version of the SDK as it has the option ALLOW_CASE_CONFLICTS enabled by default.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      Before I've used 1.1.4 SDK version, now I've changed to 2.0.0. But the above solution didn't worked and still getting the same issue and not able to open the store. Also check the below screenshot.

      Please suggest.

      Regards ,

      Hemanth.

      s9.png (6.9 kB)
  • Feb 07 at 11:35 AM

    Are you able to share the metadata document?

    Add comment
    10|10000 characters needed characters exceeded

    • In main/root metadata file, please check the entityType name which is

      <EntityType Name="SPGeo" and <EntityType Name="SPGEO" this is causing the problem.

      2019-02-08 23:24:35.599 32490-12396/com.example.heman.wizardapp E/OfflineManager: Offline store did not open. com.sap.cloud.mobile.odata.offline.OfflineODataException: :1

      EntityType Error: EntityType Name='SPGEO' collides with EntityType Name='SPGeo'. 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="SPGEO" sap:content-version="1">...

      at com.sap.cloud.mobile.odata.offline.internal.OfflineODataConverter.createOfflineODataException(OfflineODataConverter.java:112) at com.sap.cloud.mobile.odata.offline.OfflineODataProvider$Task.run(OfflineODataProvider.java:2793) at java.lang.Thread.run(Thread.java:761)

      As we can see the generated proxy class in image has options for ALLOW_CASE_CONFLICTS which has the internal value of 8192 in CSDLOption Class.

      but in below image the csdl option value has set to 143169 which is not available in CSDL Option class.

      parser.setCsdlOptions(com.example.heman.wizardapp.internal.MetaServiceMetadataParser.options); // this has been set to 143169
      

      s1.png (64.7 kB)
  • Feb 08 at 07:03 PM

    Are you able to request a change to the service? Two entity names that vary by case only is not ideal. I believe the allow case conflicts option was added to deal with conflicts in name between entities and association names.

    Add comment
    10|10000 characters needed characters exceeded