File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
Object Relational Mapping
Load Hibernate configuration from a different file
Joined: Mar 22, 2011
Mar 15, 2013 05:54:32
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?
I agree. Here's the link:
subject: Load Hibernate configuration from a different file
Problem with Hibernate and Oracle
Mapping issue in hibernate.cfg.xml
Hibernate configuration issue: connection provider or hibernate.dialect issue
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015