I have a similar problem. I have two application context files that define the dataSource and sessionFactory beans; one file for test and one for production. The production one (prod-datasource.xml, which works fine) has this:
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- setting production Hibernate properties here, blah, blah -->
<property name="mappingDirectoryLocations"
value="classpath:au/com/bisinfo/cmgr/logic"/>
</bean>
But in my test file (test-datasource.xml), if I used that format, no mapping files were found. I had to explicitly list each mapping file, like so:
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- setting test Hibernate properties here, blah, blah -->
<property name="mappingResources">
<list>
<value>au/com/bisinfo/cmgr/logic/address/Address.hbm.xml</value>
<value>au/com/bisinfo/cmgr/logic/country/Country.hbm.xml</value>
<!-- repeat for 8 other mapping files -->
</list>
</property>
</bean>
It's ugly having to maintain this list of mapping files. Anyone know why the "mappingDirectoryLocations" approach doesn't work in my test cases (which extend AbstractTransactionalDataSourceSpringContextTests) ?
Andrew