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.  [ 1 post ] 
Author Message
 Post subject: Nhibernate with many databases
PostPosted: Wed Jul 02, 2008 12:58 pm 
Newbie

Joined: Thu Mar 15, 2007 8:03 am
Posts: 8
please help me :(

I'm trying to create a project using NHibernate and 2 different databases.


What i have allready:

- App.config


Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <configSections>
      <section name="nhibernateSettings"
            type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
   </configSections>

   <nhibernateSettings>
      <sessionFactories>
         <clearFactories />
         <sessionFactory name="db1Factory" factoryConfigPath="C:\## Workspace ##\Tests\nHibernateTest2\nHibernateTest2\db1.config" isTransactional="true" />
         <sessionFactory name="db2Factory" factoryConfigPath="C:\## Workspace ##\Tests\nHibernateTest2\nHibernateTest2\db2.config" isTransactional="true" />
      </sessionFactories>
   </nhibernateSettings>
   
</configuration>



- db2.config

Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <session-factory name="db2SessionFactory">
      <property name="hibernate.connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="hibernate.dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="hibernate.connection.connection_string">
         Data Source=localhost;Database=db2;
         User ID=sa;Password=!rodrigo1981!;
      </property>
      <property name="hibernate.connection.isolation">ReadCommitted</property>
      <!-- <property name="hibernate.default_schema">MyDb.dbo</property> -->
      <!-- Assembly containing the embedded HBM mapping files -->
      <mapping assembly="nHibernateTest2" />
   </session-factory>
</configuration>



- db1.config

Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <session-factory name="db1SessionFactory">
      <property name="hibernate.connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="hibernate.dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="hibernate.connection.connection_string">
         Data Source=localhost;Database=db1;
         User ID=sa;Password=!rodrigo1981!;
      </property>
      <property name="hibernate.connection.isolation">ReadCommitted</property>
      <!-- <property name="hibernate.default_schema">MyDb.dbo</property> -->
      <!-- Assembly containing the embedded HBM mapping files -->
      <mapping assembly="nHibernateTest2" />
   </session-factory>
</configuration>



Now.... and now? :( :(

I read this tutorial: http://www.codeproject.com/KB/aspnet/NH ... leDBs.aspx

but when i don't know what to do in NHibernateSessionModule.cs for using windows forms...

Hibernate vs: 2
Code: C# windows forms


sorry for any bad english :) :)[/quote][/code]


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

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.