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

來源:互聯網
上載者:User

    一個下午,差不多都耗在這個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啊!!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.