-->
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.  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Tue Jun 05, 2007 7:46 am 
Newbie

Joined: Thu Jun 22, 2006 4:04 am
Posts: 8
Location: Prague
Marco, in your scenario I would really consider using Castle's NHiberarnateIntegrationFacility. Look at its documentation

It allows you to configure multiple SessionFactories (in xml configuration file), you can name that facories by "alias" and use its simple API to get session from specific factory (by alias)
In the same time WindsorContainer handles problem of creating SessionFactory (in web application, it creates each session factory only once - imho the worst problem with Billy's sugestion when factory is created on beginning of each request)
Add AutomaticTransactionsFacility to the mix and you get super easy way to handle your NHibernate infrastructure....
It also allows to change session lifetime by just tweaking configuration file - which allows to transparently use all my data access code in WinForms app, ASP.NET app and unit tests without any code modifications....
I'm using it more than a year now and can't imagine my NH development without it !

Look at unit test for examples

HTH
Liwoj


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 2:51 am 
Newbie

Joined: Mon Jul 02, 2007 9:28 am
Posts: 2
Location: Norway
Are there any working examples out there using Castle to use NHibernate on multiple databases? We have one single asp.net web application that needs to connect different database depending on what user logs in. User A might connect to database1, user B might connect to database2, both using same web application.

I'd love to see a working example that also adds some nice architecture (like Billy's) and test projects.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 10:22 am 
Newbie

Joined: Thu Oct 18, 2007 1:10 pm
Posts: 9
Setting up the database on different machine as a linked server on the host machine and setting the schema element as ServerName.CatalogName.dbo works fine. Thus one connection string works for multiple databases on different servers too.


Top
 Profile  
 
 Post subject: Linked Databases
PostPosted: Wed Jun 25, 2008 1:09 pm 
Newbie

Joined: Sat Dec 08, 2007 9:22 am
Posts: 10
I am doing this right now and I have hit a stumbling block, problem is that when NHibernate inserts a record is then try's to find the last identity inserted using 'select SCOPE_IDENTITY()'. Which always returns null, any ideas?


heres my post:
http://forum.hibernate.org/viewtopic.ph ... 98&start=0


Top
 Profile  
 
 Post subject: Linked Databases
PostPosted: Tue Feb 24, 2009 9:26 am 
Newbie

Joined: Tue Feb 24, 2009 8:55 am
Posts: 1
What if we use all the Databases for our Application. For example one database for one customer and other for other customer and then select on the parameters given. Then How can we select the database and configure the file.

_________________
Thanks & Regards,

Afsar ALi
Senior Programmer Analyst
PIBAS Pakistan (Pvt.) Ltd.


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

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.