When using e.g. the grails-hibernate-hijacker plugin, the sessionFactory gets proxied to get notified when a new hibernate session get created. Due to some weirdnesses in Hibernate the new session hold a reference to the unproxied original sessionfactory. This causes findDatastore to return null. A workaround for cases where only one datasource is available is to return the one and only datasource.
…les (*.iml) upon 'gradle idea' to allow unit tests running inside the IDE