DefaultPersistenceUnitManager's getPersistenceUnitInfo method has 2.5 compatible signature again (SPR-7055)
This commit is contained in:
parent
ff6abbd369
commit
4ee6735376
|
|
@ -336,8 +336,17 @@ public class DefaultPersistenceUnitManager
|
|||
* @param persistenceUnitName the name of the desired persistence unit
|
||||
* @return the PersistenceUnitInfo in mutable form, or <code>null</code> if not available
|
||||
*/
|
||||
protected final PersistenceUnitInfo getPersistenceUnitInfo(String persistenceUnitName) {
|
||||
return this.persistenceUnitInfos.get(persistenceUnitName);
|
||||
protected final MutablePersistenceUnitInfo getPersistenceUnitInfo(String persistenceUnitName) {
|
||||
PersistenceUnitInfo pui = this.persistenceUnitInfos.get(persistenceUnitName);
|
||||
if (Proxy.isProxyClass(pui.getClass())) {
|
||||
// JPA 2.0 PersistenceUnitInfo decorator with a SpringPersistenceUnitInfo as target
|
||||
Jpa2PersistenceUnitInfoDecorator dec = (Jpa2PersistenceUnitInfoDecorator) Proxy.getInvocationHandler(pui);
|
||||
return dec.getTarget();
|
||||
}
|
||||
else {
|
||||
// Must be a raw JPA 1.0 SpringPersistenceUnitInfo instance
|
||||
return (MutablePersistenceUnitInfo) pui;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -420,6 +429,10 @@ public class DefaultPersistenceUnitManager
|
|||
}
|
||||
}
|
||||
|
||||
public final SpringPersistenceUnitInfo getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if (method.getName().equals("getSharedCacheMode")) {
|
||||
return Enum.valueOf(this.sharedCacheModeEnum, this.target.getSharedCacheModeName());
|
||||
|
|
|
|||
Loading…
Reference in New Issue