// property name
PredicateOperand column = dobj.get("id");
// compare the column with the parameter
Predicate compare = column.between(lower, upper);
// set the where clause into the query
dobj.where(compare);
// create a query instance
Query query = session.createQuery(dobj);
// set the parameter values
query.setParameter("lower", 5);