NHibernate - could not find (oracle) dialect in configuration

I have the following hibernate.cfg.xml

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" > <session-factory> <property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property> <property name="connection.connection_string"> User ID=user;Password=password;Data Source=database </property> <property name="show_sql">false</property> <property name="dialect">NHibernate.Dialect.Oracle9Dialect</property> <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property> </session-factory> 

Now I get the following error:

failed: NHibernate.MappingException: Failed to compile display document: Mob.Icecube.Data.NH.Mappings.Customer.hbm.xml ----> System.InvalidOperationException: Could not find dialect in Configuration

Can someone help me why he can't find the driver? Additional information ... It only works in UnitTest application. I added NHibernate and System.Data.OracleClient to the project links. Using the latest version of NHibernate (2.2 beta)

Thanks in advance

+4
oracle nhibernate
source share
3 answers

The NHibernate assembly lacks the NHibernate.Dialect.Oracle9Dialect dialogs.

There is NHibernate.Dialect.Oracle9iDialect.

Make sure your NHibernate configuration file is loaded correctly. Use something like:

 onfiguration config = new Configuration().Configure("hibernate.cfg.xml"). 

It is assumed that your NHibernate configuration file is called hibernate.cfg.xml and is located in the root of your application.

+6
source share

I registered on the site now, and it seems that at the moment I'm no longer allowed to leave comments, so I will just send the code again in a new answer: D

To create a configuration and factory: Configuration config = new Configuration (); config.AddAssembly ("MyLib.Data.NH"); ISessionFactory factory = config.BuildSessionFactory ();

I also changed the configuration now to use (which should be available) Oracle10gDialect (although I tried 9i without success).

 <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" > <session-factory name="NHibernate.Test"> <property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property> <property name="connection.connection_string"> User ID=user;Password=password;Data Source=db </property> <property name="show_sql">false</property> <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property> <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property> </session-factory> </hibernate-configuration> 
+1
source share

Do you have an Oracle client installed locally on your computer? I believe this gives some drivers that you might need to connect, but I'm not sure. If so, try copying the Oracle.DataAccess.dll file from your installation to the bin folder of your project. This has worked for me in the past.

0
source share

All Articles