title: How do I include another xml file in my hibernate xml file
body: <p>I would like to have two hibernate config files, one pointing at the master db and the other at the slave. Rather than spell out all of the tables twice, I'd like to specify the tables in its own file and include it in both config files.</p>
  
  <p>I've tried using entities</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
      [ &lt;!ENTITY targetfilename SYSTEM "targetfilename.xml"&gt; ]&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &amp;targetfilename;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>and although it is able to create the reference, it is trying to resolve the filename in my apache bin dir:</p>
  
  <p><code>/Users/me/Environment/apache-tomcat-6.0.35/bin/targetfilename.xml</code></p>
  
  <p>That's not workable, because the path is different on my local machine vs on my prod environment. The included file is in the same dir as the main hibernate config file.</p>
  
  <p>I've tried to use <code>xi:include</code>, but it seems not to be compatible with the hibernate xml DTD, because I get the error <code>Attribute "xmlns" must be declared for element type "hibernate-configuration".</code></p>
  
  <p>I also tried </p>
  
  <pre><code>[ &lt;!ENTITY targetfilename SYSTEM "./targetfilename.xml"&gt; ]&gt;
  </code></pre>
  
  <p>but that doesn't work either.</p>
  
  <p>I would welcome any useful ideas. Thanks!</p>