Move the query preparation to the Fetchable interface; add a test for query paging