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

x33g5p2x  于2022-01-26 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(106)

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

Property.gt介绍

[英]Create a greater-than restriction based on this property
[中]基于此属性创建大于限制

代码示例

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

.add( Property.forName("salary").gt( new BigDecimal(100) ) )
  .list();
assertEquals( result.size(), 1 );

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

.add( Property.forName("salary").gt( new BigDecimal(100) ) )
  .list();
assertEquals( result.size(), 1 );

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

@Override
  public Criterion toHibernateCriterion(AbstractHibernateQuery hibernateQuery, Query.GreaterThan criterion, String alias) {
    String propertyName = getPropertyName(criterion, alias);
    Object value = criterion.getValue();
    if (value instanceof DetachedCriteria) {
      return Property.forName(propertyName).gt((DetachedCriteria) value);
    }
    return Restrictions.gt(propertyName, value);
  }
});

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

@Override
  public org.hibernate.criterion.Criterion toHibernateCriterion(HibernateQuery hibernateQuery, Query.Criterion criterion, String alias) {
    Query.GreaterThan eq = (Query.GreaterThan) criterion;
    Object value = eq.getValue();
    if (value instanceof DetachedCriteria) {
      return Property.forName(calculatePropertyName(eq.getProperty(), alias)).gt((DetachedCriteria)value);
    }
    return Restrictions.gt(calculatePropertyName(eq.getProperty(), alias), value);
  }
});

代码示例来源:origin: stackoverflow.com

int fromYear, fromMonth, toYear, toMonth;
Property year = Property.forName("year");
Property month = Property.forName("month");
session.createCriteria(CommissionSummary.class).add(Restrictions.disjunction()
  .add(Restrictions.and(year.eq(fromYear), month.ge(fromMonth))
  .add(Restrictions.and(year.gt(fromYear), year.lt(toYear))
  .add(Restrictions.and(year.eq(toYear), month.le(toMonth))
);

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

/**
 * Creates a "greater than" Criterion based on the specified property name and value
 * @param propertyName The property name
 * @param propertyValue The property value
 * @return A Criterion instance
 */
public org.grails.datastore.mapping.query.api.Criteria gt(String propertyName, Object propertyValue) {
  if (!validateSimpleExpression()) {
    throwRuntimeException(new IllegalArgumentException("Call to [gt] with propertyName [" +
        propertyName + "] and value [" + propertyValue + "] not allowed here."));
  }
  propertyName = calculatePropertyName(propertyName);
  propertyValue = calculatePropertyValue(propertyValue);
  Criterion gt;
  if (propertyValue instanceof org.hibernate.criterion.DetachedCriteria) {
    gt = Property.forName(propertyName).gt((org.hibernate.criterion.DetachedCriteria)propertyValue);
  }
  else {
    gt = Restrictions.gt(propertyName, propertyValue);
  }
  addToCriteria(gt);
  return this;
}

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

/**
 * Creates a "greater than" Criterion based on the specified property name and value
 * @param propertyName The property name
 * @param propertyValue The property value
 * @return A Criterion instance
 */
public org.grails.datastore.mapping.query.api.Criteria gt(String propertyName, Object propertyValue) {
  if (!validateSimpleExpression()) {
    throwRuntimeException(new IllegalArgumentException("Call to [gt] with propertyName [" +
        propertyName + "] and value [" + propertyValue + "] not allowed here."));
  }
  propertyName = calculatePropertyName(propertyName);
  propertyValue = calculatePropertyValue(propertyValue);
  Criterion gt;
  if (propertyValue instanceof org.hibernate.criterion.DetachedCriteria) {
    gt = Property.forName(propertyName).gt((org.hibernate.criterion.DetachedCriteria)propertyValue);
  }
  else {
    gt = Restrictions.gt(propertyName, propertyValue);
  }
  addToCriteria(gt);
  return this;
}

相关文章