title: How to configure Hibernate when you are using a Spring Session Factory
body: <p>I am trying to setup Hibernate Tools in eclipse.  The trouble is that it can't find any mapping files.</p>
  
  <p>I have created a console configuration that points to my environment.properties file and hibernate.cfg.xml.  The trouble is that there are no mappings in hibernate.cfg.xml.</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://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>it seems that it is using the spring bean sessionFactory in myproject-persistence.xml (below) to find the required mapping files.  I can't see anywhere that this file can be added to the the Console Configuration in eclipse.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
      &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt;
        &lt;property name="driverClass" value="${hibernate.connection.driver_class}" /&gt;
        &lt;property name="jdbcUrl" value="${hibernate.connection.url}" /&gt;
        &lt;property name="user" value="${hibernate.connection.username}" /&gt;
        &lt;property name="password" value="${hibernate.connection.password}" /&gt;
        &lt;property name="initialPoolSize" value="5" /&gt;
        &lt;property name="minPoolSize" value="5" /&gt;
        &lt;property name="maxPoolSize" value="25" /&gt;
        &lt;property name="acquireIncrement" value="5" /&gt;
        &lt;property name="maxIdleTime" value="1800" /&gt;
        &lt;property name="numHelperThreads" value="5" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
        &lt;property name="dataSource" ref="dataSource" /&gt;
        &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
            &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
            &lt;prop key="hibernate.transaction.factory_class"&gt;org.hibernate.transaction.JDBCTransactionFactory&lt;/prop&gt;
          &lt;/props&gt;
        &lt;/property&gt;
        &lt;property name="configLocation" value="classpath:hibernate.cfg.xml" /&gt;
        &lt;property name="mappingLocations"&gt;
          &lt;list&gt;&lt;value&gt;classpath*:com/mybusiness/myproject/platform/api/**/*.hbm.xml&lt;/value&gt;&lt;/list&gt;
        &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;tx:annotation-driven /&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>How can I get this working?</p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I managed to get a single Mapping working by adding it to the 'Mappings' tab in 'Edit Configuration'.  However, I can't use wildcards here and would have to add every mapping manually.</p>