A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Mongo DB Applied Patterns
this week in the
or a resume review from
Five Year Itch
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:
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Load Hibernate configuration from a different file
Mapping issue in hibernate.cfg.xml
Problem with Hibernate and Oracle
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-2013