Skip to content

Instantly share code, notes, and snippets.

Last active May 22, 2016 13:28
What would you like to do?
Indicate L2 cache usage via EM property
public class EmployeeManager{
EntityManager em;
public Employee getByID(String id){
em.setProperty("javax.persistence.cache.retrieveMode", CacheRetrieveMode.USE); //look for the employee in the L2 cache first
return em.find(Employee.class, id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment