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

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

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

Restrictions.sizeNe介绍

[英]Constrain a collection valued property by size
[中]按大小约束集合值属性

代码示例

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

/**
 * Creates a Criterion that contrains a collection property to be not equal to the given size
 *
 * @param propertyName The property name
 * @param size The size to constrain by
 *
 * @return A Criterion instance
 */
public org.grails.datastore.mapping.query.api.Criteria sizeNe(String propertyName, int size) {
  if (!validateSimpleExpression()) {
    throwRuntimeException(new IllegalArgumentException("Call to [sizeNe] with propertyName [" +
        propertyName + "] and size [" + size + "] not allowed here."));
  }
  propertyName = calculatePropertyName(propertyName);
  addToCriteria(Restrictions.sizeNe(propertyName, size));
  return this;
}

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

/**
 * Creates a Criterion that contrains a collection property to be not equal to the given size
 *
 * @param propertyName The property name
 * @param size The size to constrain by
 *
 * @return A Criterion instance
 */
public org.grails.datastore.mapping.query.api.Criteria sizeNe(String propertyName, int size) {
  if (!validateSimpleExpression()) {
    throwRuntimeException(new IllegalArgumentException("Call to [sizeNe] with propertyName [" +
        propertyName + "] and size [" + size + "] not allowed here."));
  }
  propertyName = calculatePropertyName(propertyName);
  addToCriteria(Restrictions.sizeNe(propertyName, size));
  return this;
}

相关文章