0

We have the following URL that leads to the desired result (executed in gw client):

//xyz.com/myEntity(key1='12345',key2=datetime'2022-02-01')/Results

I have now imported this OData API into my Java project via CDS import and am trying to recreate this query.

The OData Model looks in principle like this:

entity myEntity {
  key key1 : String;
  key key2 : Date;
  Results : Association to many mySecondEnity;
}

My select looks like:

SELECT.from(MyService_.CDS_NAME).columns(c -> c.Results().expand(...)).where(w -> w.key1().eq('12345').and().key2(...);

Our problem now is that this Where condition is of course implemented as $filter. But we have to address the entity via keys to get the results. And that without expand.

The resulting URL looks like this:

//xyz.com/myEntity?$filter=key eq '123' etc.

Is this possible in the Java SDK to have the URL look like described in the beginning?

Or do I have to build a HTTP client myself?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Tobias
  • 4,921
  • 4
  • 31
  • 40
  • Are you sure to mean [SAP Cloud SDK](https://sap.github.io/cloud-sdk/docs/java/features/odata/overview)? The "select" API indicates a different library. The SAP Cloud SDK allows for class generation on behalf of an OData $metadata / specification file. Or alternatively the _Generic OData Client_ API for advanced use cases. However I'm still wondering whether this fits your question and whether it actually brings you any measurable benefit. – Alexander Dümont Jun 22 '23 at 09:46
  • 1
    @AlexanderDümont Damn. You're right. Thanks! This is the SAP CAP framework. Too bad, there's no tag for that. Was lost in my thoughts. Then I have to go to the SAP Forum and get either no answer or just some doc links :) – Tobias Jun 22 '23 at 09:51

0 Answers0