persistence icon indicating copy to clipboard operation
persistence copied to clipboard

typesafe ways to set the CacheStoreMode and CacheRetrieveMode

Open gavinking opened this issue 1 year ago • 2 comments

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() and setCacheRetrieveMode() to EntityManager and to Query.
  • It might even be worth introducing a superinterface of CacheStoreMode, CacheRetrieveMode, and LockModeType, calling it FindOption, for example, along with new overloads of find() and refresh() with signature T find(Class<T> entityClass, Object primaryKey, FindOption... options).

gavinking avatar Sep 08 '22 20:09 gavinking