I am having a data base call which is in Oracle and i am using Spring data JPA for that.
I do have a function which utilizes this db call to retrieve the result every time in the loop.
Now my problem is most of the time the combination of parameter values are repeating. How to avoid this and is there a way to store temporarily for the given set of combination and the corresponding result set without any caching mechanism.
Any luck in Java 8 or spring data JPA itself?.
You have various options.
If you are using Hibernate you may use it's query cache: https://vladmihalcea.com/how-does-hibernate-query-cache-work/ I'm not sure if EclipseLink has a similar feature.
You may use Springs caching facility. https://spring.io/guides/gs/caching/
And of course you may role your own by assembling all the parameters in a single object with proper
equals
andhashCode
implementation and store the result in aHashMap