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
This commit is contained in:
Marc Prud'hommeaux 2006-09-17 18:52:37 +00:00
parent 9b8351c60e
commit 9ba388d243
1 changed files with 8 additions and 7 deletions

View File

@ -232,7 +232,7 @@ public class PersistenceMetaDataFactory
ClassLoader loader = repos.getConfiguration(). ClassLoader loader = repos.getConfiguration().
getClassResolverInstance().getClassLoader(cls, envLoader); getClassResolverInstance().getClassLoader(cls, envLoader);
XMLPersistenceMetaDataParser xmlParser = getXMLParser(); XMLPersistenceMetaDataParser xmlParser = getXMLParser();
xmlParser.setClassLoader(envLoader); xmlParser.setClassLoader(envLoader != null ? envLoader : loader);
xmlParser.setEnvClassLoader(envLoader); xmlParser.setEnvClassLoader(envLoader);
xmlParser.setMode(mode); xmlParser.setMode(mode);
try { try {
@ -276,15 +276,16 @@ public class PersistenceMetaDataFactory
(queryName, (NamedQuery) cls.getAnnotation(NamedQuery.class))) (queryName, (NamedQuery) cls.getAnnotation(NamedQuery.class)))
return cls; return cls;
if (cls.isAnnotationPresent(NamedQueries.class) && if (cls.isAnnotationPresent(NamedQueries.class) &&
hasNamedQuery(queryName, ((NamedQueries) cls.getAnnotation hasNamedQuery(queryName, ((NamedQueries) cls.
(NamedQueries.class)).value())) getAnnotation(NamedQueries.class)).value()))
return cls; return cls;
if (cls.isAnnotationPresent(NamedNativeQuery.class) && hasNamedNativeQuery if (cls.isAnnotationPresent(NamedNativeQuery.class) &&
(queryName, (NamedNativeQuery) cls.getAnnotation(NamedNativeQuery.class))) hasNamedNativeQuery(queryName, (NamedNativeQuery) cls.
getAnnotation(NamedNativeQuery.class)))
return cls; return cls;
if (cls.isAnnotationPresent(NamedNativeQueries.class) && if (cls.isAnnotationPresent(NamedNativeQueries.class) &&
hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls.getAnnotation hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls.
(NamedNativeQueries.class)).value())) getAnnotation(NamedNativeQueries.class)).value()))
return cls; return cls;
} }
return null; return null;