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

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

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

Restrictions.ge介绍

[英]Apply a "greater than or equal" constraint to the named property
[中]对命名属性应用“大于或等于”约束

代码示例

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

/**
 * Create a greater-than-or-equal-to restriction based on this property
 *
 * @param value The value to check against
 *
 * @return The greater-than-or-equal-to restriction
 *
 * @see Restrictions#ge(String, Object)
 */
public SimpleExpression ge(Object value) {
  return Restrictions.ge( getPropertyName(), value );
}

代码示例来源:origin: kaaproject/kaa

@Override
public List<LogAppender> findByAppIdAndSchemaVersion(String appId, int schemaVersion) {
 LOG.debug("Searching log appenders by application id [{}] and schema version [{}]",
     appId, schemaVersion);
 List<LogAppender> appenders = Collections.emptyList();
 if (isNotBlank(appId)) {
  appenders = findListByCriterionWithAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS,
    Restrictions.and(
      Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(appId)),
      Restrictions.le(LOG_APPENDER_MIN_LOG_SCHEMA_VERSION, schemaVersion),
      Restrictions.ge(LOG_APPENDER_MAX_LOG_SCHEMA_VERSION, schemaVersion))
  );
 }
 if (LOG.isTraceEnabled()) {
  LOG.trace("[{},{}] Search result: {}.", appId, schemaVersion,
      Arrays.toString(appenders.toArray()));
 } else {
  LOG.debug("[{},{}] Search result: {}.", appId, schemaVersion, appenders.size());
 }
 return appenders;
}

代码示例来源:origin: bill1012/AdminEAP

@Override
  public DetachedCriteria getCriteria(DetachedCriteria criteria, String key, Object value)
      throws QueryException {
    criteria.add(Restrictions.ge(key, value));
    return criteria;
  }
};

代码示例来源:origin: openmrs/openmrs-core

@Override
public List<CohortMembership> getCohortMemberships(Integer patientId, Date activeOnDate, boolean includeVoided) {
  Criteria criteria = sessionFactory.getCurrentSession().createCriteria(CohortMembership.class);
  criteria.add(Restrictions.eq("patientId", patientId));
  if (activeOnDate != null) {
    criteria.add(Restrictions.le("startDate", activeOnDate));
    criteria.add(Restrictions.or(
        Restrictions.isNull("endDate"),
        Restrictions.ge("endDate", activeOnDate)
    ));
  }
  if (!includeVoided) {
    criteria.add(Restrictions.eq(VOIDED, false));
  }
  return criteria.list();
}

代码示例来源:origin: bill1012/AdminEAP

@Override
  public DetachedCriteria getCriteria(DetachedCriteria criteria, String key, Object value) throws QueryException {
    List values=(List) value;
    if(values.size()==2){
      if(values.get(0)==null){
        if(values.get(1)!=null)
        criteria.add(Restrictions.le(key,values.get(1)));
      }else if(values.get(1)==null){
        criteria.add(Restrictions.ge(key,values.get(0)));
      }else{
        criteria.add(Restrictions.between(key,values.get(0),values.get(1)));
      }
    }
    return criteria;
  }
};

代码示例来源:origin: openmrs/openmrs-core

crit.add(Restrictions.ge("dateEnrolled", minEnrollmentDate));
crit.add(Restrictions.or(Restrictions.isNull("dateCompleted"), Restrictions.ge("dateCompleted",
  minCompletionDate)));

代码示例来源:origin: openmrs/openmrs-core

criteria.add(Restrictions.ge("obsDatetime", fromDate));

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see org.openmrs.api.db.OrderDAO#getActiveOrders(org.openmrs.Patient, java.util.List,
 *      org.openmrs.CareSetting, java.util.Date)
 */
@Override
@SuppressWarnings("unchecked")
public List<Order> getActiveOrders(Patient patient, List<OrderType> orderTypes, CareSetting careSetting, Date asOfDate) {
  Criteria crit = createOrderCriteria(patient, careSetting, orderTypes, false, false);
  crit.add(Restrictions.le("dateActivated", asOfDate));
  
  Disjunction dateStoppedAndAutoExpDateDisjunction = Restrictions.disjunction();
  Criterion stopAndAutoExpDateAreBothNull = Restrictions.and(Restrictions.isNull("dateStopped"), Restrictions
      .isNull("autoExpireDate"));
  dateStoppedAndAutoExpDateDisjunction.add(stopAndAutoExpDateAreBothNull);
  
  Criterion autoExpireDateEqualToOrAfterAsOfDate = Restrictions.and(Restrictions.isNull("dateStopped"), Restrictions
      .ge("autoExpireDate", asOfDate));
  dateStoppedAndAutoExpDateDisjunction.add(autoExpireDateEqualToOrAfterAsOfDate);
  
  dateStoppedAndAutoExpDateDisjunction.add(Restrictions.ge("dateStopped", asOfDate));
  
  crit.add(dateStoppedAndAutoExpDateDisjunction);
  
  return crit.list();
}

代码示例来源:origin: openmrs/openmrs-core

crit.add(Restrictions.ge("dateActivated", OpenmrsUtil.firstSecondOfDay(cal.getTime())));

代码示例来源:origin: bill1012/AdminEAP

@Override
public String getAttorneyByAssignee(String assignee, String moduleCode) {
  String hql = "from Module where code='" + moduleCode + "'";
  Module module = this.get(hql);
  if(module==null)
    return null;
  DetachedCriteria criteria = DetachedCriteria.forClass(DelegateInfo.class);
  criteria.add(Restrictions.eq("assignee", assignee));
  Date now = new Date();
  criteria.add(Restrictions.le("startTime", now));
  criteria.add(Restrictions.ge("endTime", now));
  criteria.add(Restrictions.like("moduleId", "%" + module.getId() + "%"));
  criteria.add(Restrictions.eq("deleted", 0));
  List<DelegateInfo> delegateInfos = this.findByCriteria(criteria);
  if (delegateInfos.isEmpty()) {
    return null;
  } else {
    return delegateInfos.get(0).getAttorney();
  }
}

代码示例来源:origin: openmrs/openmrs-core

criteria.add(Restrictions.ge("startDatetime", minStartDatetime));
} else {
  if (minEndDatetime != null) {
    criteria.add(Restrictions.or(Restrictions.isNull("stopDatetime"), Restrictions.ge("stopDatetime",
      minEndDatetime)));

代码示例来源:origin: openmrs/openmrs-core

Restrictions.and(Restrictions.le("startDate", startEffectiveDate), Restrictions.ge("endDate",
    startEffectiveDate))).add(
  Restrictions.and(Restrictions.le("startDate", startEffectiveDate), Restrictions.isNull("endDate"))).add(
  Restrictions.and(Restrictions.isNull("startDate"), Restrictions.ge("endDate", startEffectiveDate))).add(
  Restrictions.and(Restrictions.isNull("startDate"), Restrictions.isNull("endDate"))));
criteria.add(Restrictions.disjunction().add(
  Restrictions.and(Restrictions.le("startDate", endEffectiveDate), Restrictions
      .ge("endDate", endEffectiveDate))).add(
  Restrictions.and(Restrictions.le("startDate", endEffectiveDate), Restrictions.isNull("endDate"))).add(
  Restrictions.and(Restrictions.isNull("startDate"), Restrictions.ge("endDate", endEffectiveDate))).add(
  Restrictions.and(Restrictions.isNull("startDate"), Restrictions.isNull("endDate"))));

代码示例来源:origin: openmrs/openmrs-core

crit.add(Restrictions.ge("encounterDatetime", searchCriteria.getFromDate()));
        Restrictions.and(
            Restrictions.isNull("dateChanged"),
            Restrictions.ge("dateCreated", searchCriteria.getDateChanged())
        ),
        Restrictions.ge("dateChanged", searchCriteria.getDateChanged())

代码示例来源:origin: org.motechproject.mobile/motech-mobile-omp

@SuppressWarnings("unchecked")
public List<IVRCallSession> loadIVRCallSessionsCreatedBetweenDates(
    Date start, Date end) {
  return sessionFactory
  .getCurrentSession()
  .createCriteria(IVRCallSession.class)
  .add(Restrictions.ge("created", start))
  .add(Restrictions.le("created", end))
  .list();
}

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

@Override
public Query gte(String property, Object value) {
  addToCriteria(Restrictions.ge(calculatePropertyName(property), value));
  return this;
}

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

@Override
public Query ge(String property, Object value) {
  addToCriteria(Restrictions.ge(calculatePropertyName(property), value));
  return this;
}

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

@Override
public List<SequenceUpdateEvent> getSequenceUpdateEventWithRelativeConservationSuperiorTo(long processId, double cons) {
  return getSession().createCriteria(getEntityClass()).
      createAlias("updateProcess", "p").add(Restrictions.eq("p.id", processId)).
      add(Restrictions.ge("relativeConservation", cons))
      .addOrder(Order.asc("eventDate")).list();
}

代码示例来源:origin: org.wso2.bpel/ode-dao-hibernate

public Criterion evaluate(Object paramValue) {
 Conjunction conj = Restrictions.conjunction();
 if (!StringUtils.isEmpty(property.getNamespace())) {
  conj.add(Restrictions.ge(PROPERTY_NS_DB_FIELD, property.getNamespace()));
 }
 conj.add(Restrictions.ge(PROPERTY_NAME_DB_FIELD, property.getName()));
 conj.add(Restrictions.ge(PROPERTY_VALUE_DB_FIELD, ge.getValue().getValue()));
 return conj;
};

代码示例来源:origin: com.arsframework/ars-database

/**
 * 获取大于或等于条件匹配对象
 *
 * @param property 属性名称
 * @param value    属性值
 * @return 条件匹配对象
 */
protected Criterion getGreaterEqualCriterion(String property, Object value) {
  ConditionWrapper condition = this.getConditionWrapper(property, value);
  return Restrictions.ge(this.getCriteriaAlias(condition.getProperty()), condition.getValue());
}

代码示例来源:origin: org.geomajas.plugin/geomajas-layer-hibernate

/** {@inheritDoc} */
@Override
public Object visit(PropertyIsGreaterThanOrEqualTo filter, Object userData) {
  String propertyName = getPropertyName(filter.getExpression1());
  String finalName = parsePropertyName(propertyName, userData);
  Object literal = getLiteralValue(filter.getExpression2());
  return Restrictions.ge(finalName, castLiteral(literal, propertyName));
}

相关文章