[已关闭问题]
我在使用Nhibernate的过程中出现在如下错误:<br><title>The dialect was not set. Set the property hibernate.dialect.</title><style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style><span><h2><i>The dialect was not set. Set the property hibernate.dialect.</i>
</h2></span><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><b>说明: </b>执行当前
Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 <br><br><b>异常详细信息:
</b>NHibernate.HibernateException: The dialect was not set. Set the property
hibernate.dialect.</font><br><b>堆栈跟踪:</b> <br><br>
<table bgcolor="#ffffcc" width="100%">
<tbody>
<tr>
<td><code></code><pre>[HibernateException: The dialect was not set. Set the property hibernate.dialect.]<br> NHibernate.Dialect.Dialect.GetDialect() +120<br> NHibernate.Dialect.Dialect.GetDialect(IDictionary props) +133<br> NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +57<br><br>[MappingException: Could not compile the mapping document: Model.Person.hbm.xml]<br> NHibernate.Cfg.Configuration.LogAndThrow(MappingException me) +62<br> NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +175<br> NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name) +65<br> NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) +149<br> NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) +234<br> NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering) +314<br> NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) +36<br> NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) +182<br> NHibernate.Helper.SessionFactory.OpenSession() in E:\C#练习\NHB_Model\NHibernate.Helper\NHibernateModule.cs:36<br> NHibernateOperation.NHibernateModule.EntityControl`1..ctor() in E:\C#练习\NHB_Model\NHibernateOperation\EntityControl.cs:35<br> NHibernateOperation.NHibernateModule.CommonDatabaseOperation`1.GetEntityControl() in E:\C#练习\NHB_Model\NHibernateOperation\CommonDatabaseOperation.cs:58<br> WebDAL.PersonOperation..ctor() in E:\C#练习\NHB_Model\WebDAL\DAL.cs:13<br> _Default.Page_Load(Object sender, EventArgs e) in e:\C#练习\NHibernateWeb\Default.aspx.cs:15<br> System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31<br> System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68<br> System.Web.UI.Control.OnLoad(EventArgs e) +88<br> System.Web.UI.Control.LoadRecursive() +74<br> System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3035<br></pre></td></tr></tbody></table><br>
问题补充:
看了好久不知道错在哪里,在我的hibernate.cfg.xml中有dialect这个节点,请高手指点!!
hibernate.cfg.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test" >
<!-- properties -->
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="use_outer_join">true</property>
<property name="use_proxy_validator">true</property>
<!--<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>-->
<!-- mapping files -->
<!--<mapping assembly ="" />-->
</session-factory>
</hibernate-configuration>
连接字符串和实体类程序集在程序中添加。