protected void applySubCriteriaToJunction(
      PersistentEntity entity,
      AbstractHibernateQuery hibernateCriteria,
      List<Query.Criterion> existing,
      Junction conjunction,
      String alias) {

    for (Query.Criterion subCriterion : existing) {
      if (subCriterion instanceof Query.PropertyCriterion) {
        Query.PropertyCriterion pc = (Query.PropertyCriterion) subCriterion;
        if (pc.getValue() instanceof QueryableCriteria) {
          pc.setValue(getHibernateDetachedCriteria((QueryableCriteria<?>) pc.getValue()));
        } else {
          AbstractHibernateQuery.doTypeConversionIfNeccessary(entity, pc);
        }
      }
      CriterionAdaptor criterionAdaptor = criterionAdaptors.get(subCriterion.getClass());
      if (criterionAdaptor != null) {
        Criterion c = criterionAdaptor.toHibernateCriterion(hibernateCriteria, subCriterion, alias);
        if (c != null) conjunction.add(c);
      } else if (subCriterion instanceof FunctionCallingCriterion) {
        Criterion sqlRestriction =
            hibernateCriteria.getRestrictionForFunctionCall(
                (FunctionCallingCriterion) subCriterion, entity);
        if (sqlRestriction != null) {
          conjunction.add(sqlRestriction);
        }
      }
    }
  }
コード例 #2
0
 public org.hibernate.criterion.Criterion toHibernateCriterion(HibernateQuery hibernateQuery) {
   final CriterionAdaptor criterionAdaptor = criterionAdaptors.get(criterion.getClass());
   if (criterionAdaptor != null) {
     return criterionAdaptor.toHibernateCriterion(hibernateQuery, criterion, alias);
   }
   return null;
 }