revert HibernateUtils.handleLazyProxy method changes

I removed the handling from handleLazyProxy method in the change that implemented GroovyObject properly in Javassist proxies. However unwrapping lazy proxies is unrelated to that and it is still needed for backward compatibility. This pull request reverts and change and also contains a refactoring to simplify the code.

This change has also been ported to the hibernate4 module.