2nd level cache ignoring HINT_LOADGRAPH

Description

When loading from the 2nd level cache (Infinispan at least) Hibernate is not honoring the eager loading of attributes passed in the EntityGraph using either "HINT_LOADGRAPH" or "HINT_FETCHGRAPH".

Note that the 1st time the entity is loaded, it work as expected and the attributes get loaded instead of being proxied.

Example:

1 2 3 4 5 Map<String, Object> hints = new HashMap<>(); hints.put(QueryHints.HINT_FETCHGRAPH, getEagerFetchEntityGraph()); Bean bean = getEntityManager().find(beanClass, pk, hints); entityManager.detach(bean) bean.getAnotherBean() // Works when not loaded from cache, fails when loaded from cache.

Environment

JPA 2.1, Linux 64, Java 8, PostgreSQL 9.5, Infinispan

Status

Assignee

Unassigned

Reporter

Cloves Almeida

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

5.2.1

Priority

Major