openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1056126 - /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
Date Fri, 07 Jan 2011 00:02:05 GMT
Author: curtisr7
Date: Fri Jan  7 00:02:05 2011
New Revision: 1056126

URL: http://svn.apache.org/viewvc?rev=1056126&view=rev
Log:
OPENJPA-1918: Append PUInfo classloader to MDR.preload() classloader chain.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?rev=1056126&r1=1056125&r2=1056126&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
Fri Jan  7 00:02:05 2011
@@ -51,6 +51,7 @@ import org.apache.openjpa.lib.util.Local
 import org.apache.openjpa.lib.util.MultiClassLoader;
 import org.apache.openjpa.lib.util.Options;
 import org.apache.openjpa.lib.util.StringDistance;
+import org.apache.openjpa.util.ClassResolver;
 import org.apache.openjpa.util.ImplHelper;
 import org.apache.openjpa.util.InternalException;
 import org.apache.openjpa.util.MetaDataException;
@@ -311,10 +312,20 @@ public class MetaDataRepository implemen
             return;
         }
 
+
         MultiClassLoader multi = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
         multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()));
         multi.addClassLoader(AccessController.doPrivileged(J2DoPrivHelper
             .getClassLoaderAction(MetaDataRepository.class)));
+        // If a ClassLoader was passed into Persistence.createContainerEntityManagerFactory
on the PersistenceUnitInfo
+        // we need to add that loader to the chain of classloaders
+        ClassResolver resolver = _conf.getClassResolverInstance();
+        if (resolver != null) {
+            ClassLoader cl = resolver.getClassLoader(null, null);
+            if (cl != null) {
+                multi.addClassLoader(cl);
+            }
+        }
 
         Set<String> classes = getPersistentTypeNames(false, multi);
         if (classes == null || classes.size() == 0) {



Mime
View raw message