-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: NHibernate, multiple ISessionFactory, wcf services
PostPosted: Fri Dec 05, 2008 3:35 pm 
Newbie

Joined: Fri Dec 05, 2008 3:27 pm
Posts: 2
Hi, my application is composed of a client application and several sql server databases which is accessed by wcf services.

My client apps use wcf services to manage the databases. I want the wcf services to use NHibernate to access the databases.

I need an ISessionFactory object for each database, right?
If thats so, i how do i keep a singleton object to contain the ISessionFactory objects, which can be acessed by my wcf services? Whats the best approach?

For the moment, i could use HttpContext.Application to store the ISessionFactory objects, but i don't think thats a good idea. I've read some ppl using Windows Services. Is this a good idea?

Whats the best practises to solve this problem?


Thanks,
MFelicio.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2008 7:38 am 
Newbie

Joined: Fri Sep 28, 2007 4:12 am
Posts: 15
Yes you do need an ISessionFactory for every separate Database, that's right.

In a service I've done recently (albeit with NH 1.21GA) the ISessionfactories were stored in a HashTable that's inside some SessionManager Class. The SessionManager itself a thread-safe lazy singleton.

Any storage works for the ISessionFactories as long as its not thread-local, in contrast to the ISessions which should of course be stored thread-local.
[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.