Indicate L2 cache usage via EM property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Stateless | |
public class EmployeeManager{ | |
@persistenceContext("emp_PU") | |
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