MySQL和NHibernate.如何解决错误:列'ReservedWord'不属于表ReservedWords? [英] MySQL & NHibernate. How fix the error: Column 'ReservedWord' does not belong to table ReservedWords?
问题描述
使用NHibernate时出现了一个奇怪的错误.而且我不知道是什么导致了此错误. 我是整个Visual Studio和NHibernate的新手,但不是Hibernate的新手.我过去在Java项目中使用过Hibernate.
"I am getting a weird error when using NHibernate. And I don't know what is causing this error. I am new to the whole Visual Studio and NHibernate, but not to Hibernate. I used Hibernate in the past in Java projects.
向我指出我的错误所在的任何帮助将不胜感激.
Any help would be appreciated in pointing me where my error is.
我正在将Visual Studio 2008 SP1与Mysql 5.1一起使用.
I am using Visual Studio 2008 SP1 with Mysql 5.1.
下面是我正在使用的代码. "
Below is the code I am using. "
完整的代码和示例在此处发布: https://forum.hibernate.org/viewtopic.php?f= 25& t = 997701
The full code and examples are posted here: https://forum.hibernate.org/viewtopic.php?f=25&t=997701
推荐答案
我的第一个猜测是NHibernate将列名和/或表名标识为保留字.您的名为休眠"的类可能是罪魁祸首,但是如果没有有关您的错误的更多信息,则很难进行跟踪.一些建议:
My first guess is that NHibernate identifies a column and/or table name as a reserved word. Your class named "hibernate" could be a likely culprit but without more information about your error it's a bit hard to track down. Some suggestions:
- 尝试重命名数据库和配置中的表和列,并对其进行测试
- 下载log4net( http://logging.apache.org/log4net/download.html ),然后查看 https://www.hibernate.org/364.html 为nhibernate配置它.将其设置为调试并挖掘日志文件,然后查看有关所获得的堆栈跟踪/错误的完整信息.
- try renaming the table and columns both in the database and config and give it a test
- Download log4net (http://logging.apache.org/log4net/download.html) and check out https://www.hibernate.org/364.html to configure it for nhibernate. Set it to debug and dig into the log file and see the full information on the stacktrace/error you get.
这篇关于MySQL和NHibernate.如何解决错误:列'ReservedWord'不属于表ReservedWords?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!