Create a QueryFactory