Last active
December 23, 2015 09:19
-
-
Save sara4dev/6613568 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import org.springframework.cache.annotation.Cacheable; | |
. | |
. | |
@Cacheable("longCache") | |
public List<Product> getAllProducts(final int pageNumber) { | |
System.out.println("Inside DAO so cache did not get used"); | |
// TODO Auto-generated method stub | |
Query query = getEntityManager().createQuery("SELECT p FROM Product p"); | |
return query.setFirstResult(pageNumber * PAGE_SIZE) | |
.setMaxResults(PAGE_SIZE).getResultList(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment