Does a new SessionFactory and Session object have to be created for each database? I have a data store for my application data, and a seperate data store for my employee security, which is used to validate users. Do I have to create a new SessionFactory ans Session object for calls to the 2 different databases?
views:
450answers:
2
+1
A:
ok so this doesn't answer your question directly but it might offer an insight as to why you should create multiple session objects for each datastore.
This article explains how you can implement a thread safe lazy singleton for each type of Session you need so that you only have one session per datastore but it's shared across the entire application. So at most you're only ever going to have 2 session objects.
To directly answer your question however, you will need 1 session object per database.
lomaxx
2008-09-11 14:48:07
A:
I was already implementing this method for using 1 singleton session object. I just added a second session to the HttpModule. I was just wondering if this was necessary. I guess it is. Thanks for your informative answer.
Mark Struzinski
2008-09-11 15:30:49