SAP / olingo-jpa-processor-v4

The JPA Processor fills the gap between Olingo V4 and the database, by providing a mapping between JPA metadata and OData metadata, generating queries and supporting the entity manipulations.
Apache License 2.0
121 stars 76 forks source link

[Question] Support for nested lambda operation #319

Closed spatanjali closed 4 days ago

spatanjali commented 1 month ago

We are currently using v2.0.2 of olingo-jpa-processor-v4 library and have been trying to test the nested lambda operator usecase. Can you please kindly let me know if the library supports the nested lambda operation ?

Sample Query: http://localhost:8080/odata/Orders?$filter=OrderDetails/any(d:d/Product/any(p:p/ProductName eq 'Chai')) In this example, we're filtering the 'Orders' entity set to only those orders that contain at least one 'OrderDetail' which is associated with a 'Product' having the 'ProductName' 'Chai'. The use of 'any' within another 'any' is an instance of a nested lambda operator.

Issue We are facing a Null pointer Exception at JPALambdaOperation.getSubQuery() where uriResourceParts is being used to create an ArrayList of variable name allUriResourceParts.

Reason JPAFilterElementComplier object being created at JPANavigationSubQuery.JPANavigationSubQuery() assigns null to the uriResourceParts while parsing the 2nd lambda operator.

JPAFilterElementComplier object that is being created as part of JPANavigationSubQuery.buildExpression() assigns null to the uriResourceParts.

Is there a reason why the above is being done ?

Stack Trace image

What works ?: Single level lambda operation works as expected.

spatanjali commented 1 month ago

The issue is reproducible on v2.1.1 as well.

wog48 commented 4 days ago

Issue shall be solved with 2.1.3. In case the problem still exists, please reopen this issue. Thanks for supporting.