From 9ba388d243a54186d07445a3bcac8fb0c0da1bca Mon Sep 17 00:00:00 2001 From: Marc Prud'hommeaux Date: Sun, 17 Sep 2006 18:52:37 +0000 Subject: [PATCH] Use the environment class loader as the metadata loader only if it is not null. git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@447112 13f79535-47bb-0310-9956-ffa450edef68 --- .../persistence/PersistenceMetaDataFactory.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java index 39e686dbf..c2ec4f2e9 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java @@ -232,7 +232,7 @@ public class PersistenceMetaDataFactory ClassLoader loader = repos.getConfiguration(). getClassResolverInstance().getClassLoader(cls, envLoader); XMLPersistenceMetaDataParser xmlParser = getXMLParser(); - xmlParser.setClassLoader(envLoader); + xmlParser.setClassLoader(envLoader != null ? envLoader : loader); xmlParser.setEnvClassLoader(envLoader); xmlParser.setMode(mode); try { @@ -276,15 +276,16 @@ public class PersistenceMetaDataFactory (queryName, (NamedQuery) cls.getAnnotation(NamedQuery.class))) return cls; if (cls.isAnnotationPresent(NamedQueries.class) && - hasNamedQuery(queryName, ((NamedQueries) cls.getAnnotation - (NamedQueries.class)).value())) + hasNamedQuery(queryName, ((NamedQueries) cls. + getAnnotation(NamedQueries.class)).value())) return cls; - if (cls.isAnnotationPresent(NamedNativeQuery.class) && hasNamedNativeQuery - (queryName, (NamedNativeQuery) cls.getAnnotation(NamedNativeQuery.class))) + if (cls.isAnnotationPresent(NamedNativeQuery.class) && + hasNamedNativeQuery(queryName, (NamedNativeQuery) cls. + getAnnotation(NamedNativeQuery.class))) return cls; if (cls.isAnnotationPresent(NamedNativeQueries.class) && - hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls.getAnnotation - (NamedNativeQueries.class)).value())) + hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls. + getAnnotation(NamedNativeQueries.class)).value())) return cls; } return null;