Hi everyone.
I am maintaining an old project I just ported to latest hibernate+spring. The project does not use JPA but configure hibernate directly, via Spring, declaring a dataSource and a sessionFactory (LocalSessionFactoryBean) and injecting the sessionFactory into the HibernateTemplate, the HibernateTransactionManager etc..
My problem is that the old config has this sessionFactory property to locate the hbm.xml files
<property name="mappingDirectoryLocations" value="classpath*:com/company/service/dto/" />
Now this works but cannot be inherited to another project. So if this context file is defined in project A and B depends on A, when I deploy and start B.war, I get:
FileNotFoundException: jar:file:/home/ildella/.m2/repository/com/company/service/1.0-SNAPSHOT/service-1.0-SNAPSHOT.jar!/com/company/service/dto/
this does not happen in in test environment, where everything works both in A and B.
I am used to JPA autoscan and I never care about where I declare my hbm files.
So my questions are:
1. there is a way to get the auto-scan with hibernate without JPA? 2. what is the best way to migrate that config to one that uses the LocalEntityManagerFactoryBean?
Thanks.
|