当前位置: 首页>>代码示例>>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;未经允许,请勿转载。