We're updating the issue view to help you get more done. 

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

Affects versions

5.2.1

Priority

Major