Changes in sql queries to multiple classes