I am having problems when loading hibernate mappings from multiple paths.
My Spring session factory is define as follows:
<beans>
...
<bean id="sessionFactory" class="org.springframwork.orm.hibernate3.LocalSessionFactory">
</bean>
<property name="mappingLocations">
<list>
<value>classpath:/mapping/*.hbm.xml</value>
</list>
</property>
When I put my mappings Foo.hbm.xml
and Bar.hbm.xml
into the directory src/main/resources/mappings
, then both mappings are found when Hibernate is initialized.
But when I put Foo.hbm.xml
into the directory src/main/resources/mapping
and Bar.hbm.xml
into the directory src/test/resources/mapping
, then only the latter mapping file can be found. Hibernate will fail with "cannot find mapping for Foo" error.
I can see that the mappings are copied to the directories target/classes/mapping
and target/test-classes/mapping
, so why cannot hibernate find both mapping files? I thought that "classpath:/mapping/*.hbm.xml" would find both target/classes/mapping
and target/test-classes/mapping
directories?