• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two session-factory in one hibernate.cfg.xml

 
himaunshu shah
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to access two databases. I know this can be achieved by creating two
XML configuration files and creating two Configuration and SessionFactory objects in the application.

But is it possible to have two session-factoy tags in one hibernate.cfg.xml? If yes, then what should be the format of the cfg.cml and how to access two SessionFactory objects.

Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the DTD - only one session-factory element is allowed in a hibernate-configuration. So you'll need two config files.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic