title: Multiple Hibernate configs
body: <p>I'm currently working on building a library to modularize some of my code and I'm running into a problem with Hibernate.</p>
  
  <p>In my main application I have a hibernate config to get information it needs to run but then I also have a need for hibernate in my library since some of the objects I want could be used in other applications.</p>
  
  <p>When I start up my tomcat server, with both hibernates setup, I get errors stating that beans cannot be resolved and one that says my positional parameters are missing in my query. However, when I start up Tomcat with only the application Hibernate config it starts fine.</p>
  
  <p>Here's what the configs look like...</p>
  
  <p>From the library:</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"&gt;
  
  &lt;hibernate-configuration&gt;
  
  
  &lt;session-factory&gt;   
      &lt;mapping resource="blah.hbm.xml"/&gt;
      &lt;mapping resource="blargh.hbm.xml"/&gt;
      &lt;mapping resource="stuff.hbm.xml"/&gt;
      &lt;mapping resource="junk.hbm.xml"/&gt;
      &lt;mapping resource="this.hbm.xml"/&gt;
  &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>And from the application:</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"&gt;
  
  &lt;hibernate-configuration&gt;
  
  
  &lt;session-factory&gt;       
  
      &lt;property name="hibernate.cache.provider_class"&gt;org.hibernate.cache.EhCacheProvider&lt;/property&gt;
  
      &lt;!-- Enable the query cache  --&gt;
      &lt;property name="hibernate.cache.use_query_cache"&gt;true&lt;/property&gt;
  
      &lt;!-- Echo all executed SQL to stdout --&gt;
      &lt;property name="show_sql"&gt;false&lt;/property&gt;
  
      &lt;!-- mapping files --&gt;
  
      &lt;mapping resource="appStuff"/&gt;
      &lt;mapping resource="appBlah"/&gt;
      &lt;mapping resource="appBlargh"/&gt;
      &lt;mapping resource="appJunk"/&gt;
      &lt;mapping resource="appThis"/&gt;    
  
  &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I'm still pretty new to Hibernate and this is sort of a weird configuration.</p>