Fix NPE when sessionFactory isn't injected

Fix for bug: http://jira.grails.org/browse/GPFIXTURES-27