| Author |
Load Hibernate configuration from a different file
|
Ainar Martin
Greenhorn
Joined: Mar 22, 2011
Posts: 11
|
|
Hello,
I need to read the Hibernate configuration properties from a file name different that hibernate.cfg.xml
Following code works but is deprecated:
SessionFactory sessionFactory=new Configuration().configure("hibernate.content.cfg.xml").buildSessionFactory();
But when I try to use the new configuration method:
serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
....
it doesn't work.
How should I get Hibernate to read a different configuration file?
Thank you.
|
 |
 |
|
|
subject: Load Hibernate configuration from a different file
|
|
|