persistence
persistence copied to clipboard
typesafe ways to set the CacheStoreMode and CacheRetrieveMode
Currently, setting the CacheStoreMode
or CacheRetrieveMode
requires the use of string typing, the jakarta.persistence.cache.retrieveMode
or jakarta.persistence.cache.storeMode
properties.
This is obviously bad, and therefore:
- We should add
setCacheStoreMode()
andsetCacheRetrieveMode()
toEntityManager
and toQuery
. - It might even be worth introducing a superinterface of
CacheStoreMode
,CacheRetrieveMode
, andLockModeType
, calling itFindOption
, for example, along with new overloads offind()
andrefresh()
with signatureT find(Class<T> entityClass, Object primaryKey, FindOption... options)
.