本文整理了Java中org.hibernate.criterion.Restrictions.sizeGt
方法的一些代码示例,展示了Restrictions.sizeGt
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Restrictions.sizeGt
方法的具体详情如下:
包路径:org.hibernate.criterion.Restrictions
类名称:Restrictions
方法名:sizeGt
[英]Constrain a collection valued property by size
[中]按大小约束集合值属性
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
@Override
public Criterion toHibernateCriterion(AbstractHibernateQuery hibernateQuery, Query.SizeGreaterThan criterion, String alias) {
String propertyName = getPropertyName(criterion, alias);
Object value = criterion.getValue();
int size = value instanceof Number ? ((Number)value).intValue() : Integer.parseInt(value.toString());
return Restrictions.sizeGt(propertyName, size);
}
});
代码示例来源:origin: org.grails/grails-hibernate
@Override
public org.hibernate.criterion.Criterion toHibernateCriterion(HibernateQuery hibernateQuery, Query.Criterion criterion, String alias) {
Query.SizeGreaterThan eq = (Query.SizeGreaterThan) criterion;
return Restrictions.sizeGt(calculatePropertyName(eq.getProperty(), alias), (Integer) eq.getValue());
}
});
代码示例来源:origin: org.grails/grails-hibernate
/**
* Creates a Criterion that contrains a collection property to be greater than 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 sizeGt(String propertyName, int size) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sizeGt] with propertyName [" +
propertyName + "] and size [" + size + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
addToCriteria(Restrictions.sizeGt(propertyName, size));
return this;
}
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
/**
* Creates a Criterion that contrains a collection property to be greater than 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 sizeGt(String propertyName, int size) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sizeGt] with propertyName [" +
propertyName + "] and size [" + size + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
addToCriteria(Restrictions.sizeGt(propertyName, size));
return this;
}
代码示例来源:origin: dhis2/dhis2-core
@Override
public Criterion getHibernateCriterion( QueryPath queryPath )
{
Property property = queryPath.getProperty();
if ( property.isCollection() )
{
Integer value = QueryUtils.parseValue( Integer.class, args.get( 0 ) );
if ( value == null )
{
throw new QueryException( "Left-side is collection, and right-side is not a valid integer, so can't compare by size." );
}
return Restrictions.sizeGt( queryPath.getPath(), value );
}
return Restrictions.gt( queryPath.getPath(), args.get( 0 ) );
}
内容来源于网络,如有侵权,请联系作者删除!