Converted remaining mySQL quieries over to Hibernate HQL. Added a number
of JUnit tests.