1

What is the difference between evictAll and refresh :

em.getEntityManagerFactory().getCache().evict(AdminUtilisateur.class, user);

and

em.refresh(em.getReference(AdminUtilisateur.class, user.getId()));

And when should i use each one?

Thank you.

Youcef LAIDANI
  • 55,661
  • 15
  • 90
  • 140

1 Answers1

1

evict : Mark an instance as no longer needed in the cache.

refresh : Refresh the state of the instance from the database, overwriting changes made to the entity

Vivien SA'A
  • 727
  • 8
  • 16