private void setCacheable(MetaClass metaClass, ClassDescriptor desc, Session session) { String property = (String) session.getProperty("eclipselink.cache.shared.default"); boolean defaultCache = property == null || Boolean.valueOf(property); if ((defaultCache && !desc.isIsolated()) || desc.getCacheIsolation() == CacheIsolationType.SHARED || desc.getCacheIsolation() == CacheIsolationType.PROTECTED) { metaClass.getAnnotations().put("cacheable", true); desc.getCachePolicy().setCacheCoordinationType(CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS); } }