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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. @SuppressWarnings("unchecked")
  2. public List<Obs> getActivePregnancies(Integer patientId,
  3. Concept pregnancyConcept, Concept pregnancyStatusConcept) {
  4. Session session = sessionFactory.getCurrentSession();
  5. return (List<Obs>) session.createQuery(
  6. "select p from " + Obs.class.getName()
  7. + " p where p.person.personId = :patientId and "
  8. + "p.concept = :pregnancyConcept and "
  9. + "exists (select s from " + Obs.class.getName()
  10. + " s where s.obsGroup = p and "
  11. + "s.concept = :pregnancyStatusConcept and "
  12. + "s.valueNumeric = :trueDouble) and "
  13. + "not exists (select e from " + Obs.class.getName()
  14. + " e where e.obsGroup = p and "
  15. + "e.concept = :pregnancyStatusConcept and "
  16. + "e.valueNumeric = :falseDouble)").setInteger(
  17. "patientId", patientId).setEntity("pregnancyConcept",
  18. pregnancyConcept).setEntity("pregnancyStatusConcept",
  19. pregnancyStatusConcept).setDouble("trueDouble", 1.0).setDouble(
  20. "falseDouble", 0.0).list();
  21. }

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

  1. @SuppressWarnings("unchecked")
  2. @Override
  3. public List<FeatureRank> getThresholdFeatures(String corpusName,
  4. String featureSetName, String label, String evaluationType,
  5. Integer foldId, double param1, String param2,
  6. double evaluationThreshold) {
  7. Query q = prepareUniqueFeatureEvalQuery(corpusName, featureSetName,
  8. label, evaluationType, foldId, param1, param2,
  9. "getThresholdFeatures");
  10. q.setDouble("evaluation", evaluationThreshold);
  11. return q.list();
  12. }

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

  1. public List calculateAverageTimeByNode(long processDefinitionId, long minumumDurationMillis) {
  2. try {
  3. List tuples = session.getNamedQuery("GraphSession.calculateAverageTimeByNode")
  4. .setLong("processDefinitionId", processDefinitionId)
  5. .setDouble("minimumDuration", minumumDurationMillis)
  6. .list();
  7. if (tuples.isEmpty()) return Collections.EMPTY_LIST;
  8. List results = new ArrayList();
  9. for (Iterator i = tuples.iterator(); i.hasNext();) {
  10. Object[] values = (Object[]) i.next();
  11. AverageNodeTimeEntry entry = new AverageNodeTimeEntry();
  12. entry.setNodeId(((Number) values[0]).longValue());
  13. entry.setNodeName((String) values[1]);
  14. entry.setCount(((Number) values[2]).intValue());
  15. entry.setAverageDuration(((Number) values[3]).longValue());
  16. entry.setMinDuration(((Number) values[4]).longValue());
  17. entry.setMaxDuration(((Number) values[5]).longValue());
  18. results.add(entry);
  19. }
  20. return results;
  21. }
  22. catch (HibernateException e) {
  23. handle(e);
  24. throw new JbpmPersistenceException("could not calculate average time by node "
  25. + "for process definition " + processDefinitionId, e);
  26. }
  27. }

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

  1. public List calculateAverageTimeByNode(long processDefinitionId, long minumumDurationMillis) {
  2. try {
  3. List tuples = session.getNamedQuery("GraphSession.calculateAverageTimeByNode")
  4. .setLong("processDefinitionId", processDefinitionId)
  5. .setDouble("minimumDuration", minumumDurationMillis)
  6. .list();
  7. if (tuples.isEmpty()) return Collections.EMPTY_LIST;
  8. List results = new ArrayList();
  9. for (Iterator i = tuples.iterator(); i.hasNext();) {
  10. Object[] values = (Object[]) i.next();
  11. AverageNodeTimeEntry entry = new AverageNodeTimeEntry();
  12. entry.setNodeId(((Number) values[0]).longValue());
  13. entry.setNodeName((String) values[1]);
  14. entry.setCount(((Number) values[2]).intValue());
  15. entry.setAverageDuration(((Number) values[3]).longValue());
  16. entry.setMinDuration(((Number) values[4]).longValue());
  17. entry.setMaxDuration(((Number) values[5]).longValue());
  18. results.add(entry);
  19. }
  20. return results;
  21. }
  22. catch (HibernateException e) {
  23. handle(e);
  24. throw new JbpmPersistenceException("could not calculate average time by node "
  25. + "for process definition " + processDefinitionId, e);
  26. }
  27. }

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

  1. private Query prepareUniqueFeatureEvalQuery(String corpusName,
  2. String featureSetName, String label, String evaluationType,
  3. Integer foldId, Double param1, String param2, String queryName) {
  4. Query q = this.sessionFactory.getCurrentSession().getNamedQuery(
  5. queryName);
  6. q.setString("corpusName", nullToEmptyString(corpusName));
  7. q.setString("featureSetName", nullToEmptyString(featureSetName));
  8. q.setString("label", nullToEmptyString(label));
  9. q.setString("evaluationType", evaluationType);
  10. q.setDouble("param1", param1 == null ? 0 : param1);
  11. q.setString("param2", nullToEmptyString(param2));
  12. q.setInteger("crossValidationFoldId", foldId == null ? 0 : foldId);
  13. return q;
  14. }

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

  1. public KernelEvaluation getKernelEval(String name, String experiment,
  2. String label, int foldId, double param1, String param2) {
  3. Query q = this.getSessionFactory().getCurrentSession()
  4. .getNamedQuery("getKernelEval");
  5. q.setString("corpusName", name);
  6. q.setString("experiment", DBUtil.nullToEmptyString(experiment));
  7. q.setString("label", DBUtil.nullToEmptyString(label));
  8. q.setInteger("foldId", foldId);
  9. q.setDouble("param1", param1);
  10. q.setString("param2", DBUtil.nullToEmptyString(param2));
  11. return (KernelEvaluation) q.uniqueResult();
  12. }
  13. }

相关文章