// property
PredicateOperand propertyMagic = dobj.get("magic");
PredicateOperand propertyId = dobj.get("id");
// where
// param1 is used in two different places but same type (int) in both
dobj.where(propertyMagic.equal(param1).and(propertyId.between(param1, param2)));
Query<Employee> query = session.createQuery(dobj);
query.setParameter("param1", 4);
query.setParameter("param2", 5);
List<Employee> result = query.getResultList();
errorIfNotEqual("Wrong size of result", 1, result.size());