gavin wrote:
This has been raised before and won't be fixed, so don't bother. Its a problem with the design of the Configuration class.
Workaround:
String resource ="xxx.hbm.xml";
String schemaName = "mySchema";
ClassLoader cl = this.getClass().getClassLoader();
InputStream rsrc = cl.getResourceAsStream(resource);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
builder.setEntityResolver(DTD_RESOLVER);
org.w3c.dom.Document doc = builder.parse(rsrc);
String attribute = doc.getDocumentElement().getAttribute("schema");
doc.getDocumentElement().setAttribute("schema", schemaName);
Configuration cfg = new Configuration();
cfg.addDocument(doc);
....