@Override public Cache getCache() { return emf().getCache(); }
@Override public Object invoke(Object... args) { Cache secondLevelCache = getEntityManagerFactory( args ).getCache(); if ( secondLevelCache != null ) { secondLevelCache.evictAll(); } return null; } };
@Override public Object invoke(Object... args) { Cache secondLevelCache = getEntityManagerFactory(args).getCache(); if (secondLevelCache != null) { secondLevelCache.evictAll(); } return null; } };
@Override public Object invoke(Object... args) { Cache secondLevelCache = getEntityManagerFactory(args).getCache(); if (secondLevelCache != null) { secondLevelCache.evictAll(); } return null; } };
@Override public Object invoke(Object... args) { Cache secondLevelCache = getEntityManagerFactory(args).getCache(); if (secondLevelCache != null) { secondLevelCache.evictAll(); } return null; } };
@Override public Object invoke(Object... args) { Cache secondLevelCache = getEntityManagerFactory(args).getCache(); if (secondLevelCache != null) { secondLevelCache.evictAll(); } return null; } };
entityManager.getEntityManagerFactory().getCache().evict( Person.class );
entityManager.getEntityManagerFactory().getCache().evictAll();
/** * Instantiates a new entity manager impl. * * @param factory * the factory */ EntityManagerImpl(final EntityManagerFactory factory, final PersistenceUnitTransactionType transactionType, final PersistenceContextType persistenceContextType) { this.factory = factory; if (logger.isDebugEnabled()) { logger.debug("Creating EntityManager for persistence unit : " + getPersistenceUnit()); } this.persistenceContextType = persistenceContextType; this.persistenceCache = new PersistenceCache((Cache) factory.getCache()); this.persistenceCache.setPersistenceContextType(this.persistenceContextType); this.transactionType = transactionType; this.persistenceDelegator = new PersistenceDelegator( ((EntityManagerFactoryImpl) this.factory).getKunderaMetadataInstance(), this.persistenceCache); for (String pu : ((EntityManagerFactoryImpl) this.factory).getPersistenceUnits()) { this.persistenceDelegator.loadClient(pu, discoverClient(pu)); } if (logger.isDebugEnabled()) { logger.debug("Created EntityManager for persistence unit : " + getPersistenceUnit()); } }
Cache l2Cache = (Cache) em.getEntityManagerFactory().getCache();
@Override void handle(final ModelNode response, final String name, ManagementLookup stats, OperationContext context) { Cache secondLevelCache = stats.getEntityManagerFactory().getCache(); if (secondLevelCache != null) { secondLevelCache.evictAll(); } } };
@Override public Object invoke(Object... args) { Cache secondLevelCache = getEntityManagerFactory(args).getCache(); if (secondLevelCache != null) { secondLevelCache.evictAll(); } return null; } };
@Override public Object invoke(Object... args) { Cache secondLevelCache = getEntityManagerFactory(args).getCache(); if (secondLevelCache != null) { secondLevelCache.evictAll(); } return null; } };
@Override public List<Alert> findAlertsByPrimaryKeys(List<BigInteger> ids) { requireNotDisposed(); requireArgument(ids != null && !ids.isEmpty(), "IDs list cannot be null or empty."); EntityManager em = _emProvider.get(); em.getEntityManagerFactory().getCache().evictAll(); List<Alert> result = Alert.findByPrimaryKeys(em, ids, Alert.class); _logger.debug("Query for alerts having ids {} resulted in : {}", ids, result); return result; }
@Override public Alert findAlertByPrimaryKey(BigInteger id) { requireNotDisposed(); requireArgument(id != null && id.compareTo(ZERO) > 0, "ID must be a positive non-zero value."); EntityManager em = _emProvider.get(); em.getEntityManagerFactory().getCache().evictAll(); Alert result = Alert.findByPrimaryKey(em, id, Alert.class); _logger.debug("Query for alert having id {} resulted in : {}", id, result); return result; }
@Override public Alert findAlertByPrimaryKey(BigInteger id) { requireNotDisposed(); requireArgument(id != null && id.compareTo(ZERO) > 0, "ID must be a positive non-zero value."); EntityManager em = _emProvider.get(); em.getEntityManagerFactory().getCache().evictAll(); Alert result = Alert.findByPrimaryKey(em, id, Alert.class); _logger.debug("Query for alert having id {} resulted in : {}", id, result); return result; }
@Override public Object call() { new JpaCriteriaQuery(getSharedEntityManager()).deleteAll(type); // If the L2 cache is enabled, items will still be served from the cache // So, we need to flush that as well for the given type if (sharedEntityManager.getEntityManagerFactory().getCache() != null) { sharedEntityManager.getEntityManagerFactory().getCache().evict(type); } return null; } });
@After public void destroy() { entityManagerFactory().getCache().evictAll(); super.destroy(); }
@After public void destroy() { entityManagerFactory().getCache().evictAll(); super.destroy(); }
@After public void destroy() { entityManagerFactory().getCache().evictAll(); super.destroy(); }