Answer the question
In order to leave comments, you need to log in
How to include Spring and Hibernate configuration files?
Please help me with setting up Hibernate. Here I have a spring application, there is an xml file with a context that I load at startup (there I have declared hibernate factory, datasource beans):
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
<hibernate-configuration>
<session-factory>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
</session-factory>
</hibernate-configuration>
Answer the question
In order to leave comments, you need to log in
If placed in a separate file, then this line should help
HibernateSessionFactory.setHibernateConfigPath("путь_к_папке_с_конфигами/hibernate.cfg.xml");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question