}
if (!alreadyHasInterfaceClass) {
proxyInterfaces[0] = extensionClass;
}
EntityManagerUnwrappedTargetInvocationHandler entityManagerUnwrappedTargetInvocationHandler =
new EntityManagerUnwrappedTargetInvocationHandler(entityManager, extensionClass);
Object proxyForUnwrappedObject = Proxy.newProxyInstance(
extensionClass.getClassLoader(), //use the target classloader so the proxy has the same scope
proxyInterfaces,
entityManagerUnwrappedTargetInvocationHandler
);