This post explains how to cache query results.
But I am more interested in caching the results of jpa criteria query. My criteria query is roughly as below -
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<MyDTO> query = cb.createQuery(MyDTO.class);
Root<Packages> root = query.from(Packages.class);
Join<Packages, ProtectedItems> protectedItemsJoin = root.join("protectedItemsList", JoinType.LEFT);
I can seem to find any cache method on the query
or the criteriabuilder i.e cb
object.
How can I cache the above.