本文整理汇总了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();
}
示例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;
}
示例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;
}