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: Problem: Could not find the dialect in the configuration
PostPosted: Sat Sep 13, 2008 11:16 am 
Newbie

Joined: Sat Sep 13, 2008 8:36 am
Posts: 1
I have installed nhibernate 2.0 with MV2005.
These are my files:

ExampleClass.hbm.xml:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
<class name="NHibernateExample.ExampleClass, NHibernateExample" table="ExampleClass">
<id name="ExampleClassId" column="ExampleClassId">
<generator class="native" />
</id>
<property name="Text" />
</class>
</hibernate-mapping>

App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<nhibernate>
<add
key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="dialect"
value="NHibernate.Dialect.MsSql2005Dialect"
/>
<add
key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
/>
<add
key="connection.connection_string"
value="Server=localhost\SQLExpress;Database=NHibernateExample;Trusted_Connection=Yes;"
/>
</nhibernate>
</configuration>

Main code:
try
{
Configuration Config = new Configuration();

Config.AddAssembly("NHibernateExample");

ISessionFactory Factory = Config.BuildSessionFactory();
ISession Session = null;

Session = Factory.OpenSession();

ExampleClass ExClass = new ExampleClass();
ExClass.Text = "Test";

Session.Save(ExClass);

Session.Close();
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}

Error occur when the program try invoke third line of the code:
ISessionFactory Factory = Config.BuildSessionFactory();
in exp.message is : Could not find the dialect in the configuration.
I don't know what is wrong. I'm using .net 2.0, nhibernate from August.

Regards
difek


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 14, 2008 6:24 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
The configuration behavior changed with 2.0. Now you have to use the <hibernate-section> and the format that comes with it. <nhibernate> section is ignored.

It's one of the breaking changes listed here:

http://forum.hibernate.org/viewtopic.php?t=985289

_________________
--Wolfgang


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.