added direct access to query and dbAccess objects from Model.
check if relation is set; avoid notices.