use of org.hibernate.jpamodelgen.util.xml.XmlParsingException in project hibernate-orm by hibernate.
the class JpaDescriptorParser method loadEntityMappings.
private void loadEntityMappings(Collection<String> mappingFileNames) {
for (String mappingFile : mappingFileNames) {
InputStream stream = xmlParserHelper.getInputStreamForResource(mappingFile);
if (stream == null) {
continue;
}
EntityMappings mapping = null;
try {
Schema schema = xmlParserHelper.getSchema(ORM_SCHEMA);
mapping = xmlParserHelper.getJaxbRoot(stream, EntityMappings.class, schema);
} catch (XmlParsingException e) {
context.logMessage(Diagnostic.Kind.WARNING, "Unable to parse " + mappingFile + ": " + e.getMessage());
}
if (mapping != null) {
entityMappings.add(mapping);
}
try {
stream.close();
} catch (IOException e) {
// eat it
}
}
}
use of org.hibernate.jpamodelgen.util.xml.XmlParsingException in project hibernate-orm by hibernate.
the class JpaDescriptorParser method getPersistence.
private Persistence getPersistence() {
Persistence persistence = null;
String persistenceXmlLocation = context.getPersistenceXmlLocation();
InputStream stream = xmlParserHelper.getInputStreamForResource(persistenceXmlLocation);
if (stream == null) {
return null;
}
try {
Schema schema = xmlParserHelper.getSchema(PERSISTENCE_SCHEMA);
persistence = xmlParserHelper.getJaxbRoot(stream, Persistence.class, schema);
} catch (XmlParsingException e) {
context.logMessage(Diagnostic.Kind.WARNING, "Unable to parse persistence.xml: " + e.getMessage());
}
try {
stream.close();
} catch (IOException e) {
// eat it
}
return persistence;
}
Aggregations