entityManager.getEntityManagerFactory().getCache().evictAll()
Refresh有所不同,因为它 修改了您的对象 。该行将是
empty thecache,因此,如果您在实体管理器外部获取更改的对象,它将执行实际的数据库查询,而不是使用过时的
cached值。

entityManager.getEntityManagerFactory().getCache().evictAll()
Refresh有所不同,因为它 修改了您的对象 。该行将是
empty thecache,因此,如果您在实体管理器外部获取更改的对象,它将执行实际的数据库查询,而不是使用过时的
cached值。