我正在尝试将Spring 3与Spring 3.1.0集成。问题在于应用程序无法找到在hibernate.cfg.xml文件中声明的映射文件。最初,hibernate配置具有数据源配置,hibernate属性和映射hbm.xml文件。 高级hibernate.cfg.xml文件存在于src文件夹中。这是主文件的外观:将Spring配置文件导入Spring应用程序上下文
<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>