added support for JPA 2.1 unwrap method on EntityManagerFactory interface
This commit is contained in:
parent
66b4eb16a5
commit
27471e0555
|
@ -507,6 +507,13 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||||
// Use hashCode of EntityManagerFactory proxy.
|
// Use hashCode of EntityManagerFactory proxy.
|
||||||
return System.identityHashCode(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);
|
return this.entityManagerFactoryBean.invokeProxyMethod(method, args);
|
||||||
}
|
}
|
||||||
catch (InvocationTargetException ex) {
|
catch (InvocationTargetException ex) {
|
||||||
|
|
Loading…
Reference in New Issue