Avoid calling getQueryObject() multiple times
Depend more on the Query interface and not so much on the QueryImpl
tweaks
Merge branch 'pull-request-519'