List of usage examples for javax.persistence CacheStoreMode REFRESH
CacheStoreMode REFRESH
To view the source code for javax.persistence CacheStoreMode REFRESH.
Click Source Link
From source file:com.hiperium.dao.common.generic.GenericDAO.java
/** * /* w ww. ja v a 2s .co m*/ * @param id * @param lock * @param bypassCache * @return */ protected T findById(ID id, boolean lock, boolean bypassCache) { this.logger.debug("findById - START"); T entity = null; if (bypassCache) { this.entityManager.setProperty(RETRIEVE_MODE, CacheRetrieveMode.BYPASS); this.entityManager.setProperty(STORE_MODE, CacheStoreMode.REFRESH); entity = this.entityManager.find(this.entityClass, id); } else { entity = this.entityManager.find(this.entityClass, id); } if (lock) { this.entityManager.lock(entity, LockModeType.OPTIMISTIC_FORCE_INCREMENT); } this.logger.debug("findById - END"); return entity; }
From source file:com.hiperium.dao.common.generic.GenericDAO.java
/** * /*from w w w. j av a2s . com*/ * @param query */ private void setBypassCahe(Query query) { query.setHint(RETRIEVE_MODE, CacheRetrieveMode.BYPASS); query.setHint(STORE_MODE, CacheStoreMode.REFRESH); }