Cache c = entityManagerFactory.getCache();
if (c.contains(ComponentSpec.class, componentId)) {
EntityManager em = entityManagerFactory.createEntityManager();
ComponentSpec cs = em.find(ComponentSpec.class, componentId);
if (cs != null && cs.getObjVersion() < latestVersion) {
c.evict(ComponentSpec.class, componentId);
}
em.close();
}
}