OData Read Single Entity Best Practice

398 Views Asked by At

I'm using the OData Olingo Java API V4 to create a Rest API. I've implemented the read single entity service according to tutorial. (https://olingo.apache.org/doc/odata4/tutorials/readep/tutorial_readep.html)

How it basicaly works:

1. My service fetches a huge amount of data from the backend (Oracle SQL DB) and creates a big entity set.

2. To find the right entity from the whole entity set I'm using the recommended Util class. This class helps to search through all entities and finally returns the correct entity.

I'm new to the EJB, JSP, Servlet stuff but I don't think that there is any default Session Handling behavior to prevent the service from fetching the data again from the backend (#1.), right? Neither did I implement something like that. That's why I believe that the service will fetch the data again and again for every HTTP request.

Instead of using the Util class I would rather like to find the single entity with a SQL statement. Could that be bad in any case?

0

There are 0 best solutions below