AF
Home
Tag
Submit Notes
Ask Anything
Login
Subscribe Us
A
ny
F
orum
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.
Follow @anyforumin
hibernate-basics: How can we load hibernate configuration file from different directory?
Can we put hibernate.cfg.xml file other than src folder? If yes then how can we load it?
hibernate x 23
basics x 171
Posted On :
2014-10-11 12:25:21.0
Garima Gupta
596
1295
54552
3
Answers
Yes, you can use different path other than src. You can change the default Hibernate´s SessionFactory class by passing your "hibernate.cfg.xml" file path as an argument into the configure() method:
SessionFactory sessionFactory =
new Configuration().configure("/in/anyforum/persistence/hibernate.cfg.xml").buildSessionFactory();
return sessionFactory;
Posted On :
2014-10-11 13:36:30
Satisfied :
1 Yes
0 No
Rishi Kumar
523
1882
45674
Reply This Thread
5
Post Answer
Please Login First to Post Answer:
Login
Answer:
anyforum.in