Add some common interfaces
Could you create a common interface for all the *QueryFactory implementations? Something like proposed in http://
It could make switching for example from HibernateQueryF
Also, what about adding method getMetadata() to Query interface? All top-level Query implementations have this method, and for SubQuery implementations, it could be implemented if there is no reason to keep it hidden.