Fix for GRAILS-10252

See http://jira.grails.org/browse/GRAILS-10252 and https://github.com/grails-plugins/grails-hibernate-plugin/pull/2