Activate cache for "AutoQueryData" and "FindAll
Basically, caching for the two default queries is done via the Persistence.xml is switched on. With the strategies "ENABLE_SELECTIVE" or "DISABLE_SELECTIVE" all caches are switched on or off. Caching can then be enabled or disabled for individual entities.
-
Open the entity for which you want to change the cache strategy
-
Switch to the code area of the Entity Editor by selecting the "{} Java"
-
Insert an empty line after the last annotation
-
Now use the code template "Enable QueryCache Single" or "Enable QueryCache Full" from the palette to insert the desired line of code
-
Now you can edit the respective ENUMs for the added lines according to your needs.
CashStoreMode Explanation
Name | Function | Default |
---|---|---|
USE |
Should be used if this application is the only application accessing this data source. Since this strategy does not take into account a record modified by another JDBC data source and the cache is not updated. |
YES |
REFRESH |
This strategy should be used if other applications also write to the same database and the cache needs to be refreshed on read |
|
BYPASS |
Reads the data from the cache. However, changes are not synchronized to the cache. |