Kavi
Kavi

Reputation: 174

How to create and manage two separate session factory with Spring.net and NHibernate?

My application is interacting with two separate database. I want to inject session factory with spring.net as usually. when I am creating 2 session factory with two separate dbProviders , it is showing error. Is there any way to accomplish this task ?

Upvotes: 0

Views: 334

Answers (2)

Kavi
Kavi

Reputation: 174

I solved it by creating my own transaction API with Spring AOP.

Upvotes: 0

Marijn
Marijn

Reputation: 10557

You have to use a DelegatingLocalSessionFactory object, available for Spring.NET 1.3.1 and up. According to the docs:

due to variations in the NHibernate project's ISessionFactory API, this approach is only supported under NHibernate 2.1.2 and NHibernate 3.0

I'm not sure about NHibernate > 3.0.

Upvotes: 1

Related Questions