Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating multiple/single SessionFactory

 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that creation of session factory is expensive operation. Now assuming that i have an application1 with 10 java bean that are persisted in db and application2 with 100 java beans to be persisted.

In the application1 hibernate1.cfg.xml i have specified the mapping of all the 10 java bean and in application2 hibernate2.cfg.xml i have specified the mapping of all the 100 java beans.

Now in application1, i create a session factory sf1 and in application2 i create a session factory sf2.

Does creation of sf1 requires same amount of resources and is as "expensive" as creation of sf2.

I am trying to figure this out as i have multiple db instance, and multiple session factories are created. I want to merge all these db instance to reduce the overhead of creation of multiple session factories.

Please advise
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic