Define methods getSql for Query, and create new method createQuery for EntityManager