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

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

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

Restrictions.neProperty介绍

[英]Apply a "not equal" constraint to two properties
[中]对两个特性应用“不相等”约束

代码示例

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

/**
 * Creates a non-equality restriction between 2 properties
 *
 * @param other The other property to compare against
 *
 * @return The restriction
 *
 * @see Restrictions#neProperty(String, String)
 */
@SuppressWarnings("UnusedDeclaration")
public PropertyExpression neProperty(String other) {
  return Restrictions.neProperty( getPropertyName(), other );
}

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

/**
 * Creates a non-equality restriction between 2 properties
 *
 * @param other The other property to compare against
 *
 * @return The restriction
 *
 * @see Restrictions#neProperty(String, String)
 */
@SuppressWarnings("UnusedDeclaration")
public PropertyExpression neProperty(Property other) {
  return Restrictions.neProperty( getPropertyName(), other.getPropertyName() );
}

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

public PropertyExpression neProperty(String other) {
  return Restrictions.neProperty( getPropertyName(), other );
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public PropertyExpression neProperty(String other) {
  return Restrictions.neProperty( getPropertyName(), other );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public PropertyExpression neProperty(String other) {
  return Restrictions.neProperty( getPropertyName(), other );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public PropertyExpression neProperty(String other) {
  return Restrictions.neProperty( getPropertyName(), other );
}

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

/**
 * 获取属性不等于匹配条件
 *
 * @param property 属性名
 * @param other    属性名
 * @return 条件匹配对象
 */
protected Criterion getPropertyNotEqualCriterion(String property, String other) {
  return Restrictions.neProperty(this.getCriteriaAlias(property), this.getCriteriaAlias(other));
}

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

@Override
  public org.hibernate.criterion.Criterion toHibernateCriterion(HibernateQuery hibernateQuery, Query.Criterion criterion, String alias) {
    Query.NotEqualsProperty eq = (Query.NotEqualsProperty) criterion;
    return Restrictions.neProperty(calculatePropertyName(eq.getProperty(), alias), eq.getOtherProperty());
  }
});

代码示例来源:origin: org.n52.sensorweb.sos/hibernate-utils

/**
 * Creates a {@code Criterion} that checks that the persisted period is a "real" period ({@code begin != end}).
 *
 * @param r the property names
 *
 * @return the {@code Criterion}
 */
static PropertyExpression isPeriod(TimePrimitiveFieldDescriptor r) {
  return Restrictions.neProperty(r.getBeginPosition(), r.getEndPosition());
}

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

@Override
  public Criterion toHibernateCriterion(AbstractHibernateQuery hibernateQuery, Query.NotEqualsProperty criterion, String alias) {
    String propertyName = getPropertyName(criterion, alias);
    return Restrictions.neProperty(propertyName, criterion.getOtherProperty());
  }
});

代码示例来源:origin: 52North/SOS

/**
 * Creates a {@code Criterion} that checks that the persisted period is a "real" period ({@code begin != end}).
 *
 * @param r the property names
 *
 * @return the {@code Criterion}
 */
static PropertyExpression isPeriod(TimePrimitiveFieldDescriptor r) {
  return Restrictions.neProperty(r.getBeginPosition(), r.getEndPosition());
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public PropertyExpression neProperty(Property other) {
  return Restrictions.neProperty( getPropertyName(), other.getPropertyName() );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public PropertyExpression neProperty(Property other) {
  return Restrictions.neProperty( getPropertyName(), other.getPropertyName() );
}

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

public PropertyExpression neProperty(Property other) {
  return Restrictions.neProperty( getPropertyName(), other.getPropertyName() );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public PropertyExpression neProperty(Property other) {
  return Restrictions.neProperty( getPropertyName(), other.getPropertyName() );
}

代码示例来源:origin: org.n52.series-api.db/dao

/**
 * Create a {@code Criterion} for the {@code Meets} relation.
 *
 * @param time  the time to compare against
 * @param start the property holding the start time
 * @param end   the property holding the end time
 *
 * @return the criterion
 */
private Criterion createMeets(Time time, String end, String start) {
  if (time instanceof TimePeriod) {
    TimePeriod period = (TimePeriod) time;
    return Restrictions.and(Restrictions.eq(end, period.getStart().toDate()),
                Restrictions.neProperty(start, end));
  } else {
    return unsupported(time);
  }
}

代码示例来源:origin: org.n52.series-api.db/dao

/**
 * Create a {@code Criterion} for the {@code MetBy} relation.
 *
 * @param time  the time to compare against
 * @param start the property holding the start time
 * @param end   the property holding the end time
 *
 * @return the criterion
 */
private Criterion createMetBy(Time time, String start, String end) {
  if (time instanceof TimePeriod) {
    TimePeriod period = (TimePeriod) time;
    return Restrictions.and(Restrictions.eq(start, period.getEnd().toDate()),
                Restrictions.neProperty(start, end));
  } else {
    return unsupported(time);
  }
}

代码示例来源:origin: org.n52.series-api.db/dao

@SuppressWarnings("unchecked")
Set<String> getExtras(String datasetId, IoParameters parameters) {
  Session session = getSession();
  try {
    String alias = "datasets";
    DataDao< ? > dao = new DataDao<>(session);
    String datasetMember = QueryUtils.createAssociation(alias, DatasetEntity.PROPERTY_ID);
    List<Date> resultTimes = dao.getDefaultCriteria(getDbQuery(parameters))
                  .add(Restrictions.neProperty(DataEntity.PROPERTY_RESULT_TIME,
                                 DataEntity.PROPERTY_SAMPLING_TIME_END))
                  .setProjection(Projections.property(DataEntity.PROPERTY_RESULT_TIME))
                  .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
                  .createCriteria(DataEntity.PROPERTY_DATASET, alias)
                  .add(Restrictions.eq(datasetMember, Long.parseLong(datasetId)))
                  .list();
    return resultTimes.stream()
             .map(i -> new DateTime(i).toString())
             .collect(Collectors.toSet());
  } catch (NumberFormatException e) {
    LOGGER.debug("Could not convert id '{}' to long.", datasetId, e);
  } finally {
    returnSession(session);
  }
  return Collections.emptySet();
}

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

/**
 * Creates a Criterion that compares to class properties for !equality
 * @param propertyName The first property name
 * @param otherPropertyName The second property name
 * @return A Criterion instance
 */
public org.grails.datastore.mapping.query.api.Criteria neProperty(String propertyName, String otherPropertyName) {
  if (!validateSimpleExpression()) {
    throwRuntimeException(new IllegalArgumentException("Call to [neProperty] with propertyName [" +
        propertyName + "] and other property name [" + otherPropertyName + "] not allowed here."));
  }
  propertyName = calculatePropertyName(propertyName);
  otherPropertyName = calculatePropertyName(otherPropertyName);
  addToCriteria(Restrictions.neProperty(propertyName, otherPropertyName));
  return this;
}

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

/**
 * Creates a Criterion that compares to class properties for !equality
 * @param propertyName The first property name
 * @param otherPropertyName The second property name
 * @return A Criterion instance
 */
public org.grails.datastore.mapping.query.api.Criteria neProperty(String propertyName, String otherPropertyName) {
  if (!validateSimpleExpression()) {
    throwRuntimeException(new IllegalArgumentException("Call to [neProperty] with propertyName [" +
        propertyName + "] and other property name [" + otherPropertyName + "] not allowed here."));
  }
  propertyName = calculatePropertyName(propertyName);
  otherPropertyName = calculatePropertyName(otherPropertyName);
  addToCriteria(Restrictions.neProperty(propertyName, otherPropertyName));
  return this;
}

相关文章