本文整理了Java中org.hibernate.criterion.Property.le()
方法的一些代码示例,展示了Property.le()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.le()
方法的具体详情如下:
包路径:org.hibernate.criterion.Property
类名称:Property
方法名:le
[英]Create a less-than-or-equal-to restriction based on this property
[中]基于此属性创建小于或等于的限制
代码示例来源:origin: stackoverflow.com
.add(Restrictions.or(date2Prop.isNull(), date2Prop.le(date2Criteria)))
.addOrder(Order.desc("x"));
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
@Override
public Criterion toHibernateCriterion(AbstractHibernateQuery hibernateQuery, Query.LessThanEquals criterion, String alias) {
String propertyName = getPropertyName(criterion, alias);
Object value = criterion.getValue();
if (value instanceof DetachedCriteria) {
return Property.forName(propertyName).le((DetachedCriteria) value);
}
return Restrictions.le(propertyName, value);
}
});
代码示例来源:origin: org.onebusaway/onebusaway-transit-data-federation
@Override
public List<BlockLocationRecord> doInHibernate(Session session)
throws HibernateException, SQLException {
Criteria c = session.createCriteria(BlockLocationRecord.class);
if (blockId != null)
c.add(Property.forName("blockId").eq(blockId));
if (tripId != null)
c.add(Property.forName("tripId").eq(tripId));
if (vehicleId != null)
c.add(Property.forName("vehicleId").eq(vehicleId));
if (serviceDate != 0)
c.add(Property.forName("serviceDate").eq(serviceDate));
if (fromTime != 0)
c.add(Property.forName("time").ge(fromTime));
if (toTime != 0)
c.add(Property.forName("time").le(toTime));
if (recordLimit != 0)
c.setFetchSize(recordLimit);
c.addOrder(Order.asc("time"));
return c.list();
}
});
代码示例来源:origin: OneBusAway/onebusaway-application-modules
@Override
public List<BlockLocationRecord> doInHibernate(Session session)
throws HibernateException, SQLException {
Criteria c = session.createCriteria(BlockLocationRecord.class);
if (blockId != null)
c.add(Property.forName("blockId").eq(blockId));
if (tripId != null)
c.add(Property.forName("tripId").eq(tripId));
if (vehicleId != null)
c.add(Property.forName("vehicleId").eq(vehicleId));
if (serviceDate != 0)
c.add(Property.forName("serviceDate").eq(serviceDate));
if (fromTime != 0)
c.add(Property.forName("time").ge(fromTime));
if (toTime != 0)
c.add(Property.forName("time").le(toTime));
if (recordLimit != 0)
c.setFetchSize(recordLimit);
c.addOrder(Order.asc("time"));
return c.list();
}
});
代码示例来源: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-hibernate
@Override
public org.hibernate.criterion.Criterion toHibernateCriterion(HibernateQuery hibernateQuery, Query.Criterion criterion, String alias) {
Query.LessThanEquals eq = (Query.LessThanEquals) criterion;
Object value = eq.getValue();
if (value instanceof DetachedCriteria) {
return Property.forName(calculatePropertyName(eq.getProperty(), alias)).le((DetachedCriteria) value);
}
return Restrictions.le(calculatePropertyName(eq.getProperty(), alias), value);
}
});
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
/**
* Creates a "less than or equal to" 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 le(String propertyName, Object propertyValue) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [le] with propertyName [" +
propertyName + "] and value [" + propertyValue + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
propertyValue = calculatePropertyValue(propertyValue);
Criterion le;
if (propertyValue instanceof org.hibernate.criterion.DetachedCriteria) {
le = Property.forName(propertyName).le((org.hibernate.criterion.DetachedCriteria) propertyValue);
}
else {
le = Restrictions.le(propertyName, propertyValue);
}
addToCriteria(le);
return this;
}
代码示例来源:origin: org.grails/grails-hibernate
/**
* Creates a "less than or equal to" 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 le(String propertyName, Object propertyValue) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [le] with propertyName [" +
propertyName + "] and value [" + propertyValue + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
propertyValue = calculatePropertyValue(propertyValue);
Criterion le;
if (propertyValue instanceof org.hibernate.criterion.DetachedCriteria) {
le = Property.forName(propertyName).le((org.hibernate.criterion.DetachedCriteria) propertyValue);
}
else {
le = Restrictions.le(propertyName, propertyValue);
}
addToCriteria(le);
return this;
}
代码示例来源:origin: OneBusAway/onebusaway-application-modules
private void addQueryToCriteria(TripProblemReportQueryBean query, Criteria c) {
if (query.getAgencyId() != null) {
c.add(Property.forName("tripId.agencyId").eq(query.getAgencyId()));
}
if (query.getTripId() != null) {
c.add(Property.forName("tripId").eq(
AgencyAndIdLibrary.convertFromString(query.getTripId())));
}
if (query.getTimeFrom() != 0) {
c.add(Property.forName("time").ge(query.getTimeFrom()));
}
if (query.getTimeTo() != 0) {
c.add(Property.forName("time").le(query.getTimeTo()));
}
if (query.getStatus() != null) {
c.add(Property.forName("status").eq(query.getStatus()));
}
if (query.getLabel() != null) {
c.add(Property.forName("label").eq(query.getLabel()));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!