In .NET C#, we used Odata to filter, page, sort the database results from SQL database. Odata in .NET would actually go into the database, and query WHERE, ORDER By Filters to database, instead of extracting all the database results, and applying filtering on the api memory.
I am curious of Java Apache Olingo, queries the database internally or applies filtering on the API memory set.
Resources:
https://www.odata.org/libraries/
https://www.odata.org/documentation/odata-version-2-0/uri-conventions/
Short answer, Olingo 2 JPAProcessor will query the database to only fetch limited data if $filter and $orderby are specified.
TLDR;
There are two things we need to consider here. Apache Olingo is a framework which allows people to implement OData Server and Client in Java, bare bones it will just provide you with the Abstract Classes and Interfaces which you implement OdataProcessors
, however one wants.
Now coming to the second point there is a JPA Implementation also provided in the Olingo Project, which you can locate here
To answer your question, lets dig into the code of this project to see, how its implemented.
We will have to start with JPAProcessorImpl
and hop into process(final GetEntitySetUriInfo uriParserResultView)
, this is where the query and the actuals of how the data is fetched in the database are implemented.
At line 150 the actual query is already built,so if you pass $filter
(where clause) and $orderby
, we can see the values are actually being passed to the database and are baked in query