HibernateQueryTranslator extends
        AbstractHibernateQueryTranslator<Criterion, Orders, Projection> implements QueryTranslator<Criterion, Orders, Projection> { @Override public <N extends Number & Comparable<N>> Criterion within( String xFieldName, String yFieldName, Box<N> box) { return and( between(xFieldName, box.getA().getX(), box.getB().getX()), between(yFieldName, box.getA().getY(), box.getB().getY()) ); } HibernateQueryTranslator(HibernatePropertyResolver propertyResolver,
            BoxMaker boxMaker,
            ContainsExpressionHandler<Criterion> containsExpressionHandler);  HibernateQueryTranslator(HibernatePropertyResolver propertyResolver,
            BoxMaker boxMaker);  HibernateQueryTranslator(HibernatePropertyResolver propertyResolver); @Override Criterion eq(String fieldName, Object value); @Override Criterion ne(String fieldName, Object value); @Override Criterion lt(String fieldName, Object value); @Override Criterion lte(String fieldName, Object value); @Override Criterion gt(String fieldName, Object value); @Override Criterion gte(String fieldName, Object value); @Override Criterion between(String fieldName, Object from, Object to); @Override Criterion in(String fieldName, Object[] values); @Override Criterion notIn(String fieldName, Object[] values); @Override Criterion isNull(String fieldName); @Override Criterion notNull(String fieldName); @Override Criterion isEmpty(String fieldName); @Override Criterion notEmpty(String fieldName); @Override Criterion within(
            String xFieldName, String yFieldName, Box<N> box); @Override Criterion and(Criterion... subqueries); @Override Criterion or(Criterion... subqueries); @Override Orders order(String fieldName, Ordering.Order o); @Override Orders order(Orders... orders); @Override Projection translateProjection(Query<T, R> query);  }
@Test public void within() { String xprop = "property.x"; String yprop = "property.y"; assertEquivalent(Restrictions.conjunction() .add(Restrictions.between(xprop, box.getA().getX(), box.getB().getX())) .add(Restrictions.between(yprop, box.getA().getY(), box.getB().getY()) ), translator.within(xprop, yprop, box)); }