Hibernate3をSpring3.1.0と統合しようとしています。問題は、アプリケーションがhibernate.cfg.xmlファイルで宣言されたマッピングファイルを見つけることができないことです。最初のHibernate構成には、データソース構成、Hibernateプロパティ、およびマッピングhbm.xmlファイルがあります。マスターhibernate.cfg.xmlファイルはsrcフォルダーに存在します。マスターファイルは次のようになります。
<hibernate-configuration>
<session-factory>
<!-- Mappings -->
<mapping resource="com/test/class1.hbm.xml"/>
<mapping resource="/class2.hbm.xml"/>
<mapping resource="com/test/class3.hbm.xml"/>
<mapping resource="com/test/class4.hbm.xml"/>
<mapping resource="com/test/class5.hbm.xml"/>
Springの構成は次のとおりです。
<bean id="sessionFactoryEditSolution" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="data1"/>
<property name="mappingResources">
<list>
<value>/master.hibernate.cfg.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
</props>
</property>
</bean>