NHibernate + MySql = Weird Erro(列“ReservedWord”不属于表 ReservedWords。)

    一个下午,差不多都耗在这个XXOO上了!

    VS2008, Mvc 1.0, NHibernate 2.2, MySql XX, 按照 NH 官方示例配置 Web.config

<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
    <session-factory name="NHibernate.Test">
        <property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
        <property name="connection.connection_string">
            Database=test;Data Source=someip;User Id=blah;Password=blah
        </property>
        <property name="dialect">NHibernate.Dialect.MySQLDialect</property>
        <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
    </session-factory>
</hibernate-configuration>
 

    然后运行出现黄页:

“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------

列“ReservedWord”不属于表 ReservedWords。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.ArgumentException: 列“ReservedWord”不属于表 ReservedWords。

源错误: 


行 12: 
行 13:         static NHibernateHelper() {
行 14:             sessionFactory = new Configuration().Configure().BuildSessionFactory();
行 15:         }
行 16: 
 

源文件: E:\Documents\SVN\MIS\project\OpenService\FilesII\FilesII.DAL\NHibernateHelper.cs    行: 14 

堆栈跟踪: 


[ArgumentException: 列“ReservedWord”不属于表 ReservedWords。]
   System.Data.DataRow.GetDataColumn(String columnName) +1773557
   System.Data.DataRow.get_Item(String columnName) +13
   NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetReservedWords() +237
  ...

    寡人我辗转 Google、百度 之中文资料,终不得解;无奈,偶见一外文网页,点入、跟踪,解决:

http://www.google.cn/search?hl=zh-CN&q=nhibernate+mysql+ReservedWord&btnG=Google+搜索

https://forum.hibernate.org/viewtopic.php?f=25&t=997701

Barlog

Post subject: Re: Column 'ReservedWord' does not belong to table ReservedWords

Posted: Wed Jul 22, 2009 9:43 am 

Newbie

Joined: Wed Jul 22, 2009 9:24 am
Posts: 1

Greetings.
Just add following line to configuration file to <session-factory> section.
<property name="hbm2ddl.keywords">none</property>
However this fix might cause unexpected problems. :|
Best regards.

_________________
Infinite diversity in infinite combination

    我XX他个OO啊!!

你可能感兴趣的:(Hibernate)