Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we Write more than 2 hibernate.cfg.xml's?

 
Barry Van
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can we Write more than 2 hibernate.cfg.xml's?
If yes, How to add sessions? please give with exampls?
 
Barry Van
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code rite? please check..if wrong.. how can we use 2 cfg.xml's?

Configuration cfg = new Configuration();
cfg.addFile("hibernate.cfg.xml");
cfg.addFile("hibernate2.cfg.xml");

sessionFactory = cfg.buildSessionFactory();
 
Barry Van
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Please any one resolve the above Issues..
 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that is possible.
Look at the below code. Hope that might be of some help.
 
Barry Van
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Please check this code.. Is it write..?
Is it Possible to use morethan one cfg xmls?

Configuration cfg = new Configuration();
cfg.configure("hibernate1.cfg.xml");
cfg.configure("hibernate2.cfg.xml");
// sessionFactory = new Configuration().configure().buildSessionFactory();
sessionFactory = cfg.buildSessionFactory();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic