Friday, July 22, 2011

eclipselink refresh cache

If JPA 2.0 is used, this can be done using the JPA Cache interface:

em.getEntityManagerFactory().getCache().evictAll();

In JPA 1.0 this can be done using the EclipseLink IdentityMapAccessor:

((JpaEntityManager)em.getDelegate()).getServerSession().getIdentityMapAccessor().invalidateAll();

Source: http://wiki.eclipse.org/EclipseLink/Examples/JPA/Caching

No comments:

Post a Comment