diff --git a/JavaSource/hibernate-configuration-3.0.dtd b/JavaSource/hibernate-configuration-3.0.dtd new file mode 100644 index 00000000..ccc26a81 --- /dev/null +++ b/JavaSource/hibernate-configuration-3.0.dtd @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JavaSource/hibernate-mapping-3.0.dtd b/JavaSource/hibernate-mapping-3.0.dtd new file mode 100644 index 00000000..e1f3305e --- /dev/null +++ b/JavaSource/hibernate-mapping-3.0.dtd @@ -0,0 +1,1031 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JavaSource/org/unitime/commons/hibernate/util/HibernateUtil.java b/JavaSource/org/unitime/commons/hibernate/util/HibernateUtil.java index 29be3f17..592c9528 100644 --- a/JavaSource/org/unitime/commons/hibernate/util/HibernateUtil.java +++ b/JavaSource/org/unitime/commons/hibernate/util/HibernateUtil.java @@ -47,6 +47,8 @@ import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.Text; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; /** * @author Tomas Muller @@ -212,6 +214,19 @@ public static void configureHibernate(Properties properties) throws Exception { Configuration cfg = new Configuration(); sLog.debug(" -- configuration object created"); + + cfg.setEntityResolver(new EntityResolver() { + public InputSource resolveEntity(String publicId, String systemId) { + if (publicId.equals("-//Hibernate/Hibernate Mapping DTD 3.0//EN")) { + return new InputSource(HibernateUtil.class.getClassLoader().getResourceAsStream("hibernate-mapping-3.0.dtd")); + } else if (publicId.equals("-//Hibernate/Hibernate Configuration DTD 3.0//EN")) { + return new InputSource(HibernateUtil.class.getClassLoader().getResourceAsStream("hibernate-configuration-3.0.dtd")); + } + return null; + } + }); + sLog.debug(" -- added entity resolver"); + cfg.configure(document); sLog.debug(" -- hibernate configured"); @@ -242,6 +257,18 @@ public static void closeHibernate() { public static void configureHibernateFromRootDAO(String cfgName, Configuration cfg) { try { + cfg.setEntityResolver(new EntityResolver() { + public InputSource resolveEntity(String publicId, String systemId) { + if (publicId.equals("-//Hibernate/Hibernate Mapping DTD 3.0//EN")) { + return new InputSource(HibernateUtil.class.getClassLoader().getResourceAsStream("hibernate-mapping-3.0.dtd")); + } else if (publicId.equals("-//Hibernate/Hibernate Configuration DTD 3.0//EN")) { + return new InputSource(HibernateUtil.class.getClassLoader().getResourceAsStream("hibernate-configuration-3.0.dtd")); + } + return null; + } + }); + sLog.debug(" -- added entity resolver"); + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); sLog.debug(" -- document factory created"); DocumentBuilder builder = factory.newDocumentBuilder(); diff --git a/WebContent/help/Release-Notes.xml b/WebContent/help/Release-Notes.xml index dc818446..b50a6957 100644 --- a/WebContent/help/Release-Notes.xml +++ b/WebContent/help/Release-Notes.xml @@ -38,6 +38,15 @@ + + Configuration + + Hibernate DTDs bundled with the application. + This is to avoid application deployment problems when Hibernate is unable to validate configuration because of a poor internet connection. + See Q9 of http://wiki.unitime.org/Timetabling_Installation_FAQ + + + diff --git a/build.xml b/build.xml index f0039692..5b902056 100644 --- a/build.xml +++ b/build.xml @@ -93,6 +93,7 @@ +