/**
* INTERNAL:
*/
protected void loadSpecifiedMappingFiles(boolean throwExceptionOnFail) {
PersistenceUnitInfo puInfo = m_project.getPersistenceUnitInfo();
for (String mappingFileName : puInfo.getMappingFileNames()) {
try {
Enumeration<URL> mappingFileURLs = m_loader.getResources(mappingFileName);
if (!mappingFileURLs.hasMoreElements()){
mappingFileURLs = m_loader.getResources("/./" + mappingFileName);
}
if (mappingFileURLs.hasMoreElements()) {
URL nextURL = mappingFileURLs.nextElement();
if (nextURL == null) {
nextURL = mappingFileURLs.nextElement();
}
if (mappingFileURLs.hasMoreElements()) {
// Switched to warning, same file can be on the classpath twice in some deployments,
// should not be an error.
logThrowable(ValidationException.nonUniqueMappingFileName(puInfo.getPersistenceUnitName(), mappingFileName));
}
// Read the document through OX and add it to the project.
m_project.addEntityMappings(XMLEntityMappingsReader.read(nextURL, m_loader, m_project.getPersistenceUnitInfo().getProperties()));
} else {
handleORMException(ValidationException.mappingFileNotFound(puInfo.getPersistenceUnitName(), mappingFileName), mappingFileName, throwExceptionOnFail);
}
} catch (IOException e) {
handleORMException(PersistenceUnitLoadingException.exceptionLoadingORMXML(mappingFileName, e), mappingFileName, throwExceptionOnFail);
}
}