Fixing enhanceSessionFactories implementation, and hacking into hibernate plugin to ensure doWithDinamicMethods gets called correctly