Rename classes to remove the redundant Database prefix and move query exceptions into the query namespace.