openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgras...@apache.org
Subject svn commit: r1367126 - /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
Date Mon, 30 Jul 2012 15:40:36 GMT
Author: jgrassel
Date: Mon Jul 30 15:40:35 2012
New Revision: 1367126

URL: http://svn.apache.org/viewvc?rev=1367126&view=rev
Log:
OPENJPA-2227: OpenJPA doesn't find custom SequenceGenerators

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

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java?rev=1367126&r1=1367125&r2=1367126&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
Mon Jul 30 15:40:35 2012
@@ -276,9 +276,18 @@ public class SequenceMetaData
             plugin.setString(_plugin);
             String clsName = plugin.getClassName();
 
-            Class cls = Class.forName(clsName, true,
-                AccessController.doPrivileged(
-                    J2DoPrivHelper.getClassLoaderAction(Seq.class)));
+            Class cls = null;
+            try {
+                cls = Class.forName(clsName, true,
+                    AccessController.doPrivileged(J2DoPrivHelper.getClassLoaderAction(Seq.class)));
+            } catch (ClassNotFoundException cnfe) {
+                // Target sequence type is loaded by the ClassLoader responsible for OpenJPA
classes.
+                // This can happen if the custom sequence implementation is a class that
belongs to
+                // a child ClassLoader - a situation that can easily happen in a JEE environment.
+                // Fall back to the envLoader to try load the class.
+                cls = Class.forName(clsName, true, envLoader);
+            }
+            
             StringBuilder props = new StringBuilder();
             if (plugin.getProperties() != null)
                 props.append(plugin.getProperties());



Mime
View raw message