users@jpa-spec.java.net

[jpa-spec users] Entity graphs and cache

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Thu, 4 May 2017 00:23:27 +0200

Consider an entity in JPA is cached in the 2nd level cache, i.e. such that
the following returns true:

entityManager.getEntityManagerFactory().getCache().contains(SomeEntity.class,
1);

Now suppose SomeEntity has a relation foo that is eager and not loaded.

When subsequently querying for this entity with
the javax.persistence.fetchgraph hint with an entity graph that specifies
foo to be fetched, foo will not actually be fetched for most persistence
providers (tested Hibernate and EclipseLink). Instead, the entity from the
cache will be returned without taking into account which attributes are
currently loaded and how that relates to the fetch graph.

Could the MR clarify this and add a TCK test for it?

Kind regards,
Arjan Tijms