According JPA Specification the method detach removes the given entity from the persistence context (first level cache). It is not correct to evict stuff in second level (NaturalIdCache) too. This is a reissue of https://hibernate.atlassian.net/browse/HHH-14944 containing a testcase and solution proposal adapted for branch 6.2. |