Paginator - Fixes in the query builder adapter

Contains fixes from the #3040 PR and fix #2065 for 2.0.0
Revert "Paginator - Fixes in the query builder adapter"

This reverts commit d8aa98dc81fa9ff4914f671a72151a647b6f1d6f.
Fix #2065 for 2.0.0
Fix #2065 for 2.0.0