-->
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.  [ 3 posts ] 
Author Message
 Post subject: Could not find the dialect in the configuration
PostPosted: Mon Jun 01, 2009 10:57 pm 
Newbie

Joined: Mon Jun 01, 2009 10:45 pm
Posts: 2
Every time load the hbm.xml file,I met this problem. Could not find the dialect in the configuration
And below it's my code.
1 app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.1.4000,Culture=neutral, PublicKeyToken=b77a5c561934e089,Custom=null" />
</configSections>
<nhibernate xmlns="urn:nhibernate-configuration-2.2">
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.prepare_sql" value="false" />
<add key="hibernate.cache.provider_class" value="NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache" />
<add key="relativeExpiration" value="30" />

<add key="hibernate.dialect" value="NHibernate.Dialect.Oracle9Dialect"/>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.OracleDataClientDriver" />
<add key="hibernate.connection.connection_string" value="Data Source=DATABASE;Persist Security Info=True;User ID=cyd;Password=cyd;Unicode=True;" />
<add key="hibernate.hbm" value="CorpTemplate.Business" />
<property name="dialect">NHibernate.Dialect.Oracle9Dialect </property>
</nhibernate>
</configuration>

2 userinfor class
namespace NHibernateLearning
{
public class UserInfor
{
private string _userID;
public string UserID
{
get { return _userID; }
set { _userID = value; }
}

private string _userName;
public string UserName
{
get { return _userName; }
set { _userName = value; }
}
}
}

3. UserInfor.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="NHibernateLearning" namespace="NHibernateLearning">
<class name="NHibernateLearning.UserInfor, UserInfor" table="userinfor">
<id name="UserID" column="userid" type="string">
<generator class="native" />
</id>
<property name="userName" column= "userName" type="string" length="20"/>
</class>
</hibernate-mapping>

4 form

public Form1()
{
1 InitializeComponent();

2 mCfg.AddXmlFile("D:\\C#\\NHibernateLearning\\NHibernateLearning\\UserInfor.hbm.xml");

3 sessionFactory = mCfg.BuildSessionFactory();
}
every time when the program runs to the line 2 ,I will meet this problem.
Could not compile the mapping document: D:\\C#\\NHibernateLearning\\NHibernateLearning\\UserInfor.hbm.xml"} and the inner exception is
Could not find the dialect in the configuration
I have set the UserInfor.hbm.xml's property to the Embedded Resource.
Is there some body can help me. I just start to learn Nhibernate. Thanks a lot!


Top
 Profile  
 
 Post subject: Re: Could not find the dialect in the configuration
PostPosted: Tue Jun 02, 2009 9:03 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Which hibernate version do you use ? There've be breaking changes going from 1.2 to 2.0:

•<nhibernate> section is ignored, using <hibernate-configuration> section (note that they have different XML formats)
•Configuration values are no longer prefixed by "hibernate.", if before you would specify "hibernate.dialect", now you specify just "dialect"

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: Could not find the dialect in the configuration
PostPosted: Tue Jun 02, 2009 9:47 am 
Newbie

Joined: Mon Jun 01, 2009 10:45 pm
Posts: 2
Thanks! I will try and post the result later.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.