openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r739055 - /openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
Date Thu, 29 Jan 2009 22:40:07 GMT
Author: awhite
Date: Thu Jan 29 22:40:06 2009
New Revision: 739055

URL: http://svn.apache.org/viewvc?rev=739055&view=rev
Log:
Integ 739054 from main line.


Modified:
    openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java

Modified: openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java?rev=739055&r1=739054&r2=739055&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
(original)
+++ openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
Thu Jan 29 22:40:06 2009
@@ -48,6 +48,7 @@
 import org.apache.openjpa.lib.meta.MetaDataParser;
 import org.apache.openjpa.lib.util.J2DoPriv5Helper;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.lib.util.MultiClassLoader;
 import org.apache.openjpa.lib.util.Options;
 import org.apache.openjpa.meta.AbstractCFMetaDataFactory;
 import org.apache.openjpa.meta.ClassMetaData;
@@ -237,10 +238,24 @@
      * Parse the given XML resource.
      */
     private void parseXML(URL xml, Class cls, int mode, ClassLoader envLoader) {
+        // spring needs to use the envLoader first for all class resolution,
+        // but we must still fall back on application loader
         ClassLoader loader = repos.getConfiguration().
-            getClassResolverInstance().getClassLoader(cls, envLoader);
+            getClassResolverInstance().getClassLoader(cls, null);
+        if (envLoader != null && envLoader != loader) {
+            MultiClassLoader mult = new MultiClassLoader();
+            mult.addClassLoader(envLoader);
+ 
+            // loader from resolver is usually a multi loader itself
+            if (loader instanceof MultiClassLoader)
+                mult.addClassLoaders((MultiClassLoader)loader);
+            else
+                mult.addClassLoader(loader);
+            loader = mult;
+        }
+
         XMLPersistenceMetaDataParser xmlParser = getXMLParser();
-        xmlParser.setClassLoader(envLoader != null ? envLoader : loader);
+        xmlParser.setClassLoader(loader);
         xmlParser.setEnvClassLoader(envLoader);
         xmlParser.setMode(mode);
         try {



Mime
View raw message