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().
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;