當前位置: 首頁>>代碼示例>>Java>>正文


Java TypedQuery.setHint方法代碼示例

本文整理匯總了Java中javax.persistence.TypedQuery.setHint方法的典型用法代碼示例。如果您正苦於以下問題:Java TypedQuery.setHint方法的具體用法?Java TypedQuery.setHint怎麽用?Java TypedQuery.setHint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.persistence.TypedQuery的用法示例。


在下文中一共展示了TypedQuery.setHint方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: get

import javax.persistence.TypedQuery; //導入方法依賴的package包/類
@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();
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:8,代碼來源:PartijRepositoryImpl.java

示例2: findCode

import javax.persistence.TypedQuery; //導入方法依賴的package包/類
@Override
public ConceptEntity findCode(String codeSystemUri, String code) {


    ConceptEntity conceptEntity = null;
    CriteriaBuilder builder = em.getCriteriaBuilder();

    CriteriaQuery<ConceptEntity> criteria = builder.createQuery(ConceptEntity.class);
    Root<ConceptEntity> root = criteria.from(ConceptEntity.class);


    List<Predicate> predList = new LinkedList<Predicate>();
    List<ConceptEntity> results = new ArrayList<ConceptEntity>();
    Join<ConceptEntity,CodeSystemRepository> join = root.join("codeSystemEntity");

    log.debug("Looking for code ="+code+" in "+codeSystemUri);
    Predicate pcode = builder.equal(root.get("code"), code);
    predList.add(pcode);

    Predicate psystem = builder.equal(join.get("codeSystemUri"), codeSystemUri);
    predList.add(psystem);

    Predicate[] predArray = new Predicate[predList.size()];
    predList.toArray(predArray);

    criteria.select(root).where(predArray);

    TypedQuery<ConceptEntity> qry = em.createQuery(criteria);
    qry.setHint("javax.persistence.cache.storeMode", "REFRESH");
    List<ConceptEntity> qryResults = qry.getResultList();

    for (ConceptEntity concept : qryResults) {
        conceptEntity = concept;
        log.debug("Found for code="+code+" ConceptEntity.Id="+conceptEntity.getId());
        break;
    }

    return conceptEntity;
}
 
開發者ID:nhsconnect,項目名稱:careconnect-reference-implementation,代碼行數:40,代碼來源:RIConceptRepository.java

示例3: findCode

import javax.persistence.TypedQuery; //導入方法依賴的package包/類
@Override
public ConceptEntity findCode(Coding coding) {


    ConceptEntity conceptEntity = null;
    CriteriaBuilder builder = em.getCriteriaBuilder();

    CriteriaQuery<ConceptEntity> criteria = builder.createQuery(ConceptEntity.class);
    Root<ConceptEntity> root = criteria.from(ConceptEntity.class);


    List<Predicate> predList = new LinkedList<Predicate>();
    List<ConceptEntity> results = new ArrayList<ConceptEntity>();
    Join<ConceptEntity,CodeSystemRepository> join = root.join("codeSystemEntity");

    log.debug("Looking for code ="+coding.getCode()+" in "+coding.getSystem());
    Predicate pcode = builder.equal(root.get("code"), coding.getCode());
    predList.add(pcode);

    Predicate psystem = builder.equal(join.get("codeSystemUri"), coding.getSystem());
    predList.add(psystem);

    Predicate[] predArray = new Predicate[predList.size()];
    predList.toArray(predArray);

    criteria.select(root).where(predArray);

    TypedQuery<ConceptEntity> qry = em.createQuery(criteria);
    qry.setHint("javax.persistence.cache.storeMode", "REFRESH");
    List<ConceptEntity> qryResults = qry.getResultList();

    for (ConceptEntity concept : qryResults) {
        conceptEntity = concept;
        log.debug("Found for code="+coding.getCode()+" ConceptEntity.Id="+conceptEntity.getId());
        break;
    }

    return conceptEntity;
}
 
開發者ID:nhsconnect,項目名稱:careconnect-reference-implementation,代碼行數:40,代碼來源:ConceptDao.java


注:本文中的javax.persistence.TypedQuery.setHint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。