use buildCriteria and buildLimitOrOffset methods to simplify code.
full spell w as where.