How to refresh getResultList collection of entities when JPA cache is enabled.
I mean:
List customers = query.getResultList();
????? > em.refresh ( customers ) ! // i need refresh because the cache is enabled.
RGDS
Navid
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In JPA 2.0 it might be easier to skip the L2 cache entirely, by using a query hint. For example :
This isn’t available in JPA 1.0 though. If you’re on JPA 1.0 you may have to use a vendor specific API. I believe Hibernate provides something similar to the JPA 2.0 hint (other providers might also have this mechanism). OpenJPA has a refreshAll(Collection c) method that should also work for you, and I suspect other providers have something similar. EclipseLink doesn’t seem to have one though.