本文整理了Java中org.hibernate.criterion.Restrictions.isEmpty
方法的一些代码示例,展示了Restrictions.isEmpty
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Restrictions.isEmpty
方法的具体详情如下:
包路径:org.hibernate.criterion.Restrictions
类名称:Restrictions
方法名:isEmpty
[英]Constrain a collection valued property to be empty
[中]将集合值属性约束为空
代码示例来源:origin: hibernate/hibernate-orm
/**
* Creates a restriction to check that a collection is empty
*
* @return The restriction
*
* @see Restrictions#isEmpty(String)
*/
public Criterion isEmpty() {
return Restrictions.isEmpty( getPropertyName() );
}
代码示例来源:origin: openmrs/openmrs-core
private void addEmptyVisitsByPatientCriteria(Criteria criteria, Patient patient, boolean includeVoided, String query) {
criteria.add(Restrictions.eq("patient", patient));
criteria.add(Restrictions.isEmpty("encounters"));
if (!includeVoided) {
criteria.add(Restrictions.eq("voided", includeVoided));
}
if (query != null && !StringUtils.isBlank(query)) {
criteria.createAlias("visitType", "visitType", JoinType.LEFT_OUTER_JOIN);
criteria.createAlias("location", "location", JoinType.LEFT_OUTER_JOIN);
Disjunction or = Restrictions.disjunction();
criteria.add(or);
or.add(Restrictions.ilike("visitType.name", query, MatchMode.ANYWHERE));
or.add(Restrictions.ilike("location.name", query, MatchMode.ANYWHERE));
}
criteria.addOrder(Order.desc("startDatetime"));
criteria.addOrder(Order.desc("visitId"));
}
代码示例来源:origin: org.grails/grails-hibernate
@Override
public org.hibernate.criterion.Criterion toHibernateCriterion(HibernateQuery hibernateQuery, Query.Criterion criterion, String alias) {
Query.IsEmpty eq = (Query.IsEmpty) criterion;
return Restrictions.isEmpty(calculatePropertyName(eq.getProperty(), alias));
}
});
代码示例来源:origin: org.grails/grails-hibernate
@Override
public Query isEmpty(String property) {
org.hibernate.criterion.Criterion criterion = Restrictions.isEmpty(calculatePropertyName(property));
addToCriteria(criterion);
return this;
}
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
@Override
public Criterion toHibernateCriterion(AbstractHibernateQuery hibernateQuery, Query.IsEmpty criterion, String alias) {
String propertyName = getPropertyName(criterion, alias);
return Restrictions.isEmpty(propertyName);
}
});
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
public Criterion isEmpty() {
return Restrictions.isEmpty(getPropertyName());
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public Criterion isEmpty() {
return Restrictions.isEmpty(getPropertyName());
}
代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model
@Override
public List<ProteinUpdateProcess> getUpdateProcessWithoutErrors() {
return getSession().createCriteria(getEntityClass()).
add(Restrictions.isEmpty("updateErrors")).list();
}
}
代码示例来源:origin: denimgroup/threadfix
@Override
public List<Finding> getFindingsWithIds(List<Integer> findingIds) {
if (findingIds == null || findingIds.isEmpty()) {
return list();
}
return sessionFactory.getCurrentSession()
.createCriteria(Finding.class)
.add(isEmpty("statisticsCounters"))
.add(in("id", findingIds))
.list();
}
代码示例来源:origin: denimgroup/threadfix
private Criteria getBaseCounterCriteria(List<Integer> appIds, Collection<Integer> findingIdRestrictions) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Finding.class)
.createAlias("vulnerability", "vulnAlias")
.createAlias("vulnAlias.application", "appAlias")
.add(eq("appAlias.active", true))
.add(isEmpty("statisticsCounters"));
if (findingIdRestrictions != null && !findingIdRestrictions.isEmpty()) {
criteria.add(in("id", findingIdRestrictions));
}
if (appIds != null && !appIds.isEmpty()) {
criteria.add(in("appAlias.id", appIds));
}
return criteria;
}
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
@Override
public Query isEmpty(String property) {
org.hibernate.criterion.Criterion criterion = Restrictions.isEmpty(calculatePropertyName(property));
addToCriteria(criterion);
return this;
}
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
public org.grails.datastore.mapping.query.api.Criteria isEmpty(String property) {
String propertyName = calculatePropertyName(property);
addToCriteria(Restrictions.isEmpty(propertyName));
return this;
}
代码示例来源:origin: org.grails/grails-hibernate
public org.grails.datastore.mapping.query.api.Criteria isEmpty(String property) {
String propertyName = calculatePropertyName(property);
addToCriteria(Restrictions.isEmpty(propertyName));
return this;
}
代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model
@Override
public List<DeadProteinEvent> getAllDeadProteinEventsWithoutDeletedXrefs(long id) {
return getSession().createCriteria(DeadProteinEvent.class).
createAlias("updateProcess", "p").add(Restrictions.eq("p.id", id)).
add(Restrictions.isEmpty("deletedXrefs"))
.addOrder(Order.asc("eventDate")).list();
}
}
代码示例来源:origin: org.grails/grails-hibernate
@Override
public Query isEmpty(String property) {
org.hibernate.criterion.Criterion criterion = Restrictions.isEmpty(calculatePropertyName(property));
addToCriteria(criterion);
return this;
}
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
@Override
public Query isEmpty(String property) {
org.hibernate.criterion.Criterion criterion = Restrictions.isEmpty(calculatePropertyName(property));
addToCriteria(criterion);
return this;
}
代码示例来源:origin: denimgroup/threadfix
@Override
public long getNumberWithoutGenericMappings(Integer scanId) {
return (Long) sessionFactory.getCurrentSession()
.createCriteria(Finding.class)
.createAlias("channelVulnerability", "vuln")
.add(Restrictions.isEmpty( "vuln.vulnerabilityMaps" ))
.add(eq("scan.id", scanId))
.setProjection(rowCount())
.uniqueResult();
}
代码示例来源:origin: denimgroup/threadfix
@Override
public List<Integer> findingIdsThatNeedCounters(Collection<Integer> findingIdRestrictions) {
List<Integer> findingIds = sessionFactory.getCurrentSession().createCriteria(Finding.class)
.createAlias("vulnerability", "vulnAlias")
.createAlias("vulnAlias.application", "appAlias")
.add(eq("appAlias.active", true))
.add(isEmpty("statisticsCounters"))
.setProjection(property("id"))
.list();
Set<Integer> restrictionSet = setFrom(findingIdRestrictions);
Set<Integer> emptyStatsCountersTests = setFrom(findingIds);
emptyStatsCountersTests.retainAll(restrictionSet);
return listFrom(emptyStatsCountersTests);
}
代码示例来源:origin: com.arsframework/ars-database
/**
* 获取空条件匹配对象
*
* @param property 属性名称
* @return 条件匹配对象
*/
protected Criterion getEmptyCriterion(String property) {
if (Hibernates.getPropertyType(this.sessionFactory, this.model, property).isCollectionType()) {
return Restrictions.isEmpty(this.getCriteriaAlias(property));
}
return Restrictions.isNull(this.getCriteriaAlias(property));
}
代码示例来源:origin: hibernate/hibernate-search
/**
* A batch indexing job cannot have 2 types of restrictions in the same time. Either JPQL / HQL or Criteria approach
* is used. Using both will leads to illegal argument exception.
*/
@Test(expected = IllegalArgumentException.class)
public void testRestrictedBy_twoRestrictionTypes() {
MassIndexingJob.parameters()
.forEntity( String.class )
.restrictedBy( "from string" )
.restrictedBy( Restrictions.isEmpty( "dummy" ) );
}
内容来源于网络,如有侵权,请联系作者删除!