hibernate3 module changes synchronized to hibernate4 module

I made a patch after commit 114b02 of changes in hibernate3 module and applied the changes to hibernate4 module:

``` git diff 114b02...master ../grails-datastore-gorm-hibernate | sed -e 's/hibernate3/hibernate4/g' | patch -p2 -f```

I tried to fix the conflicts in the correct way. I was wondering that hibernate4 module has it's own HibernateTemplate implementation. I hope the changes are ok that I made there. It contains the changes for GRAILS-10063 and GRAILS-10064.