0

@Configuration class having one of the @bean declaration for hibernate SessionFactory. its mappingResource("hbm file path") method is not locating my.hbm.xml and hence getting "cannot be opened because it does not exists." I applied many strategies but no luck any help will be appreciated. For clear exposure, added screenshots as well.

project folder structure

@Bean
public SessionFactory hibernateSessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource (dataSource());
sessionFactory.setLobHandler(lobHandler());
List<String> mappingResources = new ArrayList<>();
mappingResources.add("hibernate/Customer RequestDTO.hbm.xml");
mappingResources.add("hibernate/AccessRequestDTO.hbm.xml");
mappingResources.add("hibernate/AccessRequestItemDTO.hbm.xml");
sessionFactory.setMappingResources (mapping Resources.toArray(new String[mappingResources.size()]));
sessionFactory.setHibernate Properties (hibernateProperties());
try {
sessionFactory.after PropertiesSet();
} catch (java.lang. Exception e) {
LOG.error("Error creating Session Facotry", e);
}
return (SessionFactory) sessionFactory.getObject();
}

Issue : java.io.FileNotFoundException : Class Path Resource [CutomerRequestDTO.hbm.xml] cannot be opened because it does not exists.

Thanks in Advance!!!

0 Answers0