- if you are looking for an answer specific to hibernation, check @Mark's answer
Given the Employee example, provided that the number of employees can scale over time, it is best to use the approach to query the database to get accurate data. However, if you are considering something like a Department (for example), where the likelihood of fast data growth is less, it is useful to query all of them and keep them in memory - this way you do not need to go to an external resource (database) every time, which can be expensive .
So these are common parameters,
- data scaling
- business criticality
- data volume
- frequency of use
to make sense when the data will not be scaled often, but the data is not critical for the critical and the amount of data is managed in memory on the application server and is used often - bring it all and filter it out programmatically, if necessary.
if otherwise only certain data is received.
humblelistener
source share