mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
added support for JPA 2.1 unwrap method on EntityManagerFactory interface
This commit is contained in:
+7
@@ -507,6 +507,13 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
// Use hashCode of EntityManagerFactory proxy.
|
||||
return System.identityHashCode(proxy);
|
||||
}
|
||||
else if (method.getName().equals("unwrap")) {
|
||||
// Handle JPA 2.1 unwrap method - could be a proxy match.
|
||||
Class targetClass = (Class) args[0];
|
||||
if (targetClass == null || targetClass.isInstance(proxy)) {
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
return this.entityManagerFactoryBean.invokeProxyMethod(method, args);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
|
||||
Reference in New Issue
Block a user