org.hibernate.Query.setDouble()方法的使用及代码示例

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

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

Query.setDouble介绍

[英]Bind a positional double-valued parameter.
[中]绑定位置双值参数。

代码示例

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

tx = s.beginTransaction();
Query q = s.createQuery( "from Machine m where m.weight >= :weight" );
q.setDouble( "weight", new Double( 10 ) );
List result = q.list();
assertEquals( 2, result.size() );

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

session.createFilter( human.getFriends(), "where this.heightInches < ?1" ).setDouble( 1, 51d ).list().size(),
session.createFilter( human.getFriends(), "where this.heightInches > ?1" ).setDouble( 1, 51d ).list().size(),

代码示例来源:origin: riotfamily/riot

public TypedQuery<T> setDouble(int position, double val) {
  query.setDouble(position, val);
  return this;
}

代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate

@Override
public Query setDouble(int i, double v) {
  return query.setDouble(i, v);
}

代码示例来源:origin: riotfamily/riot

public TypedQuery<T> setDouble(String name, double val) {
  query.setDouble(name, val);
  return this;
}

代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate

@Override
public Query setDouble(String s, double v) {
  return query.setDouble(s, v);
}

代码示例来源:origin: ezbz/projectx

@Override
public Query setDouble(final int position, final double val) {
 return query.setDouble(position, val);
}

代码示例来源:origin: ezbz/projectx

@Override
public Query setDouble(final String name, final double val) {
 return query.setDouble(name, val);
}

代码示例来源:origin: org.motechproject/motech-server-core

@SuppressWarnings("unchecked")
public List<Obs> getActivePregnancies(Integer patientId,
                   Concept pregnancyConcept, Concept pregnancyStatusConcept) {
  Session session = sessionFactory.getCurrentSession();
  return (List<Obs>) session.createQuery(
      "select p from " + Obs.class.getName()
          + " p where p.person.personId = :patientId and "
          + "p.concept = :pregnancyConcept and "
          + "exists (select s from " + Obs.class.getName()
          + " s where s.obsGroup = p and "
          + "s.concept = :pregnancyStatusConcept and "
          + "s.valueNumeric = :trueDouble) and "
          + "not exists (select e from " + Obs.class.getName()
          + " e where e.obsGroup = p and "
          + "e.concept = :pregnancyStatusConcept and "
          + "e.valueNumeric = :falseDouble)").setInteger(
      "patientId", patientId).setEntity("pregnancyConcept",
      pregnancyConcept).setEntity("pregnancyStatusConcept",
      pregnancyStatusConcept).setDouble("trueDouble", 1.0).setDouble(
      "falseDouble", 0.0).list();
}

代码示例来源:origin: apache/ctakes

@SuppressWarnings("unchecked")
@Override
public List<FeatureRank> getThresholdFeatures(String corpusName,
    String featureSetName, String label, String evaluationType,
    Integer foldId, double param1, String param2,
    double evaluationThreshold) {
  Query q = prepareUniqueFeatureEvalQuery(corpusName, featureSetName,
      label, evaluationType, foldId, param1, param2,
      "getThresholdFeatures");
  q.setDouble("evaluation", evaluationThreshold);
  return q.list();
}

代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl

public List calculateAverageTimeByNode(long processDefinitionId, long minumumDurationMillis) {
 try {
  List tuples = session.getNamedQuery("GraphSession.calculateAverageTimeByNode")
   .setLong("processDefinitionId", processDefinitionId)
   .setDouble("minimumDuration", minumumDurationMillis)
   .list();
  if (tuples.isEmpty()) return Collections.EMPTY_LIST;
  List results = new ArrayList();
  for (Iterator i = tuples.iterator(); i.hasNext();) {
   Object[] values = (Object[]) i.next();
   AverageNodeTimeEntry entry = new AverageNodeTimeEntry();
   entry.setNodeId(((Number) values[0]).longValue());
   entry.setNodeName((String) values[1]);
   entry.setCount(((Number) values[2]).intValue());
   entry.setAverageDuration(((Number) values[3]).longValue());
   entry.setMinDuration(((Number) values[4]).longValue());
   entry.setMaxDuration(((Number) values[5]).longValue());
   results.add(entry);
  }
  return results;
 }
 catch (HibernateException e) {
  handle(e);
  throw new JbpmPersistenceException("could not calculate average time by node "
   + "for process definition " + processDefinitionId, e);
 }
}

代码示例来源:origin: com.github.albfernandez/jbpm-jpdl

public List calculateAverageTimeByNode(long processDefinitionId, long minumumDurationMillis) {
 try {
  List tuples = session.getNamedQuery("GraphSession.calculateAverageTimeByNode")
   .setLong("processDefinitionId", processDefinitionId)
   .setDouble("minimumDuration", minumumDurationMillis)
   .list();
  if (tuples.isEmpty()) return Collections.EMPTY_LIST;
  List results = new ArrayList();
  for (Iterator i = tuples.iterator(); i.hasNext();) {
   Object[] values = (Object[]) i.next();
   AverageNodeTimeEntry entry = new AverageNodeTimeEntry();
   entry.setNodeId(((Number) values[0]).longValue());
   entry.setNodeName((String) values[1]);
   entry.setCount(((Number) values[2]).intValue());
   entry.setAverageDuration(((Number) values[3]).longValue());
   entry.setMinDuration(((Number) values[4]).longValue());
   entry.setMaxDuration(((Number) values[5]).longValue());
   results.add(entry);
  }
  return results;
 }
 catch (HibernateException e) {
  handle(e);
  throw new JbpmPersistenceException("could not calculate average time by node "
   + "for process definition " + processDefinitionId, e);
 }
}

代码示例来源:origin: apache/ctakes

private Query prepareUniqueFeatureEvalQuery(String corpusName,
    String featureSetName, String label, String evaluationType,
    Integer foldId, Double param1, String param2, String queryName) {
  Query q = this.sessionFactory.getCurrentSession().getNamedQuery(
      queryName);
  q.setString("corpusName", nullToEmptyString(corpusName));
  q.setString("featureSetName", nullToEmptyString(featureSetName));
  q.setString("label", nullToEmptyString(label));
  q.setString("evaluationType", evaluationType);
  q.setDouble("param1", param1 == null ? 0 : param1);
  q.setString("param2", nullToEmptyString(param2));
  q.setInteger("crossValidationFoldId", foldId == null ? 0 : foldId);
  return q;
}

代码示例来源:origin: apache/ctakes

public KernelEvaluation getKernelEval(String name, String experiment,
      String label, int foldId, double param1, String param2) {
    Query q = this.getSessionFactory().getCurrentSession()
        .getNamedQuery("getKernelEval");
    q.setString("corpusName", name);
    q.setString("experiment", DBUtil.nullToEmptyString(experiment));
    q.setString("label", DBUtil.nullToEmptyString(label));
    q.setInteger("foldId", foldId);
    q.setDouble("param1", param1);
    q.setString("param2", DBUtil.nullToEmptyString(param2));
    return (KernelEvaluation) q.uniqueResult();
  }
}

相关文章