return getClassMetaData(schemaName, true);
}
private ClassMetaData getClassMetaData(String alias, boolean assertValid) {
ClassLoader loader = getClassLoader();
MetaDataRepository repos = resolver.getConfiguration().
getMetaDataRepositoryInstance();
// first check for the alias
ClassMetaData cmd = repos.getMetaData(alias, loader, false);
if (cmd != null)
return cmd;
// now check for the class name; this is not technically permitted
// by the JPA spec, but is required in order to be able to execute
// JPQL queries from other facades (like JDO) that do not have
// the concept of entity names or aliases
Class<?> c = resolver.classForName(alias, null);
if (c != null)
cmd = repos.getMetaData(c, loader, assertValid);
else if (assertValid)
cmd = repos.getMetaData(alias, loader, false);
if (cmd == null && assertValid) {
String close = repos.getClosestAliasName(alias);
if (close != null)
throw parseException(EX_USER, "not-schema-name-hint",
new Object[]{ alias, close, repos.getAliasNames() }, null);
else
throw parseException(EX_USER, "not-schema-name",
new Object[]{ alias, repos.getAliasNames() }, null);
}
return cmd;
}