A better option than defining each mapping resource using the mappingResources property of LocalSessionFactoryBean is using mappingDirectoryLocations with something like the following, only needed once for all the system.
<bean id="sessionFactory"> <property name="dataSource"> <ref bean="dataSource"> </ref> <property name="mappingDirectoryLocations"> <list> <value>net/sf/oness</value> </list> </property> <property name="hibernateProperties"> <ref bean="hibernateProperties"> </ref> </property> </property> </bean>
But be careful, this doesn’t allow you to use classpath locations, they have to be in the filesystem. AFAIK there’s no way to use all mapping files in the classpath under some package, that would be the best solution, e.g. I wanna use all *.hbm.xml in the classpath under net/sf/oness