I don't think a WeavingHook is required to solve this issue, the problem is that the ClassLoaderService is not used when creating proxy classes. I've done a quick test, inline override the ProxyFactory#getClassLoader and return TCCL there, this does fix the issue but is kind of a hack .
In my experience a WeavingHook is hard to use and error prone due to timing issues, these timing issues can partially be resolved using Capabilities but this would tie the persistence bundle to Hibernate as other providers most likely don't provide this Capability.
|