org.hibernate.criterion.Restrictions.isNotEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(247)

本文整理了Java中org.hibernate.criterion.Restrictions.isNotEmpty方法的一些代码示例,展示了Restrictions.isNotEmpty的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Restrictions.isNotEmpty方法的具体详情如下:
包路径:org.hibernate.criterion.Restrictions
类名称:Restrictions
方法名:isNotEmpty

Restrictions.isNotEmpty介绍

[英]Constrain a collection valued property to be non-empty
[中]将集合值属性约束为非空

代码示例

代码示例来源:origin: hibernate/hibernate-orm

/**
 * Creates a restriction to check that a collection is not empty
 *
 * @return The restriction
 *
 * @see Restrictions#isNotEmpty(String)
 */
public Criterion isNotEmpty() {
  return Restrictions.isNotEmpty( getPropertyName() );
}

代码示例来源:origin: gocd/gocd

public Users findNotificationSubscribingUsers() {
  return (Users) transactionTemplate.execute((TransactionCallback) transactionStatus -> {
    Criteria criteria = sessionFactory.getCurrentSession().createCriteria(User.class);
    criteria.setCacheable(true);
    criteria.add(Restrictions.isNotEmpty("notificationFilters"));
    criteria.add(Restrictions.eq("enabled", true));
    return new Users(criteria.list());
  });
}

代码示例来源:origin: hibernate/hibernate-orm

.createAlias("student", "s")
.createAlias("course", "c")
.add( Restrictions.isNotEmpty("s.enrolments") )
.setCacheable(true)
.setReadOnly( true )
.createAlias("course", "c")
.setReadOnly( true )
.add( Restrictions.isNotEmpty("s.enrolments") )
.setCacheable(true)
.setReadOnly( true )
.createAlias("student", "s")
.createAlias("course", "c")
.add( Restrictions.isNotEmpty("s.enrolments") )
.setCacheable(true)
.list();

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

@Override
  public Criterion toHibernateCriterion(AbstractHibernateQuery hibernateQuery, Query.IsNotEmpty criterion, String alias) {
    String propertyName = getPropertyName(criterion, alias);
    return Restrictions.isNotEmpty(propertyName);
  }
});

代码示例来源:origin: org.grails/grails-hibernate

@Override
public Query isNotEmpty(String property) {
  addToCriteria(Restrictions.isNotEmpty(calculatePropertyName(property)));
  return this;
}

代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model

/**
 *
 * @param id
 * @return
 */
public List<T> getReportsWithSeveralPossibleUniprotByResultId(long id) {
  return getSession().createCriteria(getEntityClass())
      .createAlias("updateResult", "u").add(Restrictions.eq("u.id", id))
      .add(Restrictions.isNotEmpty("possibleAccessions")).list();
}

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

@Override
public Query isNotEmpty(String property) {
  addToCriteria(Restrictions.isNotEmpty(calculatePropertyName(property)));
  return this;
}

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

@Override
public Query isNotEmpty(String property) {
  addToCriteria(Restrictions.isNotEmpty(calculatePropertyName(property)));
  return this;
}

代码示例来源:origin: org.grails/grails-hibernate

@Override
public Query isNotEmpty(String property) {
  addToCriteria(Restrictions.isNotEmpty(calculatePropertyName(property)));
  return this;
}

代码示例来源:origin: org.grails/grails-hibernate

public org.grails.datastore.mapping.query.api.Criteria isNotEmpty(String property) {
  String propertyName = calculatePropertyName(property);
  addToCriteria(Restrictions.isNotEmpty(propertyName));
  return this;
}

代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model

@Override
public List<UniprotUpdateEvent> getUniprotUpdateEventWithUpdatedXrefs(long processId) {
  return getSession().createCriteria(getEntityClass()).
      createAlias("updateProcess", "p").add(Restrictions.eq("p.id", processId)).
      add(Restrictions.isNotEmpty("updatedXrefs"))
      .addOrder(Order.asc("eventDate")).list();
}

代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model

@Override
public List<UniprotUpdateEvent> getUniprotUpdateEventWithUpdatedAnnotations(long processId) {
  return getSession().createCriteria(getEntityClass()).
      createAlias("updateProcess", "p").add(Restrictions.eq("p.id", processId)).
      add(Restrictions.isNotEmpty("updatedAnnotations"))
      .addOrder(Order.asc("eventDate")).list();
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

public int countInteractorInvolvedInInteraction() {
  final Long count = (Long) getSession().createCriteria(InteractorImpl.class)
      .add(Restrictions.isNotEmpty("activeInstances"))
      .setProjection(Projections.rowCount()).uniqueResult();
  return count.intValue();
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

public Integer countUniprotProteinsInvolvedInInteractions() {
  final Long count = (Long) criteriaForUniprotProteins()
      .add(Restrictions.isNotEmpty("activeInstances"))
      .setProjection(Projections.rowCount()).uniqueResult();
  return count.intValue();
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

public Integer countUniprotProteinsInvolvedInInteractions() {
  final Long count = (Long) criteriaForUniprotProteins()
      .add(Restrictions.isNotEmpty("activeInstances"))
      .setProjection(Projections.rowCount()).uniqueResult();
  return count.intValue();
}

代码示例来源:origin: uk.ac.ebi.intact/intact-core

public int countInteractorInvolvedInInteraction() {
  return ( Integer ) getSession().createCriteria( InteractorImpl.class )
      .add( Restrictions.isNotEmpty( "activeInstances" ) )
      .setProjection( Projections.rowCount() ).uniqueResult();
}

代码示例来源:origin: uk.ac.ebi.intact/intact-core

public List<ProteinImpl> getUniprotProteinsInvolvedInInteractions( Integer firstResult, Integer maxResults ) {
  Criteria crit = criteriaForUniprotProteins()
      .add( Restrictions.isNotEmpty( "activeInstances" ) )
      .addOrder( Order.asc( "xref.primaryId" ) );
  if ( firstResult != null && firstResult >= 0 ) {
    crit.setFirstResult( firstResult );
  }
  if ( maxResults != null && maxResults > 0 ) {
    crit.setMaxResults( maxResults );
  }
  return crit.list();
}

代码示例来源:origin: uk.ac.ebi.intact/intact-core

public Integer countUniprotProteinsInvolvedInInteractions() {
  return ( Integer ) criteriaForUniprotProteins()
      .add( Restrictions.isNotEmpty( "activeInstances" ) )
      .setProjection( Projections.rowCount() ).uniqueResult();
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

public List<ProteinImpl> getUniprotProteinsInvolvedInInteractions( Integer firstResult, Integer maxResults ) {
  Criteria crit = criteriaForUniprotProteins()
      .add( Restrictions.isNotEmpty( "activeInstances" ) )
      .addOrder( Order.asc( "xref.primaryId" ) )
      .addOrder( Order.asc("ac"));
  return autosetFirstMax(firstResult, maxResults, crit);
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

public List<ProteinImpl> getUniprotProteinsInvolvedInInteractions( Integer firstResult, Integer maxResults ) {
  Criteria crit = criteriaForUniprotProteins()
      .add( Restrictions.isNotEmpty( "activeInstances" ) )
      .addOrder( Order.asc( "xref.primaryId" ) )
      .addOrder( Order.asc("ac"));
  return autosetFirstMax(firstResult, maxResults, crit);
}

相关文章