Java 类javax.persistence.CacheRetrieveMode 实例源码

项目:OperatieBRP    文件:PartijRepositoryImpl.java   
@Override
public List<Partij> get() {
    final TypedQuery<Partij> query = em.createQuery("select p from Partij p where p.isActueelEnGeldig = true", Partij.class);
    query.setHint("javax.persistence.cache.retrieveMode", CacheRetrieveMode.BYPASS);
    query.setHint("javax.persistence.cache.storeMode", CacheStoreMode.REFRESH);
    return query.getResultList();
}
项目:OperatieBRP    文件:LeveringsautorisatieRepositoryImpl.java   
private void zetDefaults(final Query query) {
    final Calendar cal = Calendar.getInstance();
    final int maandenTerug = -DATUM_EINDE_TERUG_MAAND;
    cal.add(Calendar.MONTH, maandenTerug);
    final Integer waarde = DatumUtil.vanDatumNaarInteger(cal.getTime());
    query.setParameter("dateinde", waarde);
    query.setHint("javax.persistence.cache.retrieveMode", CacheRetrieveMode.BYPASS);
    query.setHint("javax.persistence.cache.storeMode", CacheStoreMode.REFRESH);
}
项目:jpa-unit    文件:CleanupCacheIT.java   
@Before
public void configureEntityManager() {
    // These are defaults but put here for documentation purposes
    manager.setProperty("javax.persistence.cache.storeMode", CacheStoreMode.USE);
    manager.setProperty("javax.persistence.cache.retrieveMode", CacheRetrieveMode.USE);
}
项目:jpa-unit    文件:AbstractCleanupCacheTest.java   
@Before
public void configureEntityManager() {
    // These are defaults but put here for documentation purposes
    manager.setProperty("javax.persistence.cache.storeMode", CacheStoreMode.USE);
    manager.setProperty("javax.persistence.cache.retrieveMode", CacheRetrieveMode.USE);
}
项目:jpa-unit    文件:CleanupCacheIT.java   
@Before
public void configureEntityManager() {
    // These are defaults but put here for documentation purposes
    manager.setProperty("javax.persistence.cache.storeMode", CacheStoreMode.USE);
    manager.setProperty("javax.persistence.cache.retrieveMode", CacheRetrieveMode.USE);
}
项目:oldSyncopeIdM    文件:AbstractDAOImpl.java   
protected CacheRetrieveMode getCacheRetrieveMode() {
    return entityManager.getProperties().containsKey(CACHE_RETRIEVE_MODE)
            ? (CacheRetrieveMode) entityManager.getProperties().get(
            CACHE_RETRIEVE_MODE) : CacheRetrieveMode.BYPASS;
}
项目:oldSyncopeIdM    文件:AbstractDAOImpl.java   
protected void setCacheRetrieveMode(final CacheRetrieveMode retrieveMode) {
    if (retrieveMode != null) {
        entityManager.getProperties().
                put(CACHE_RETRIEVE_MODE, retrieveMode);
    }
}
项目:devicehive-java-server    文件:CacheConfig.java   
private CacheConfig(CacheRetrieveMode retrieveMode, CacheStoreMode storeMode) {
    this.retrieveMode = retrieveMode;
    this.storeMode = storeMode;
}
项目:devicehive-java-server    文件:CacheConfig.java   
public CacheRetrieveMode getRetrieveMode() {
    return retrieveMode;
}
项目:devicehive-java-server    文件:CacheConfig.java   
/**
 * get entities from cache
 */
public static CacheConfig get() {
    return new CacheConfig(CacheRetrieveMode.USE, CacheStoreMode.USE);
}
项目:devicehive-java-server    文件:CacheConfig.java   
/**
 * get entities from db and refresh cache
 */
public static CacheConfig refresh() {
    return new CacheConfig(CacheRetrieveMode.USE, CacheStoreMode.REFRESH);
}
项目:devicehive-java-server    文件:CacheConfig.java   
/**
 * bypass cache
 */
public static CacheConfig bypass() {
    return new CacheConfig(CacheRetrieveMode.BYPASS, CacheStoreMode.BYPASS);
}
项目:devicehive-java-server    文件:CacheHelper.java   
public static void cacheable(Query query) {
    query.setHint(CACHEBLE, true);
    query.setHint(RETRIEVE_MODE, CacheRetrieveMode.USE);
    query.setHint(STORE_MODE, CacheStoreMode.USE);
}