title: In the hibernate.cfg.xml file, can you use both mapping resource, and mapping class in the same session factory?
body: <p>I'm making putting together a system that does the basic job of persisting hibernate POJOs into a database.  We've got a bit of a legacy system in place at the moment where the older POJOs are generated by hbm.xml files, but the new POJOs are just annotated classes.</p>
  
  <p>this is my hibernate.cfg.xml file</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 name=""&gt;
          &lt;!-- Database connection settings HSQL DB --&gt;
          &lt;property name="connection.driver_class"&gt;org.hsqldb.jdbcDriver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:hsqldb:mem:test&lt;/property&gt;
          &lt;property name="connection.username"&gt;sa&lt;/property&gt;
          &lt;property name="connection.password" /&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.HSQLDialect&lt;/property&gt;
          &lt;property name="hbm2ddl.auto"&gt;create-drop&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;property name="show_comments"&gt;true&lt;/property&gt;
          &lt;property name="hibernate.connection.pool_size"&gt;0&lt;/property&gt;
          &lt;mapping resource="com/dto/Address.hbm.xml" /&gt;
          &lt;mapping class="com.dto.Customer"/&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>This is ok except when it comes time to Unit testing and it appears that having both a resource and a class mapping in the cfg.xml file seems to break unit tests at build time.</p>
  
  <pre><code>    &lt;mapping resource="com/dto/Address.hbm.xml" /&gt;
      &lt;mapping class="com.dto.Customer"/&gt;
  </code></pre>
  
  <p>Is there a way round this?  Can I even use the 2 differnt mapping types in a hibernate.cfg.xml file?</p>