\"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 use
This resolves the same error when using ActiveRecord for NHibernate. The relevant bit is key="hbm2ddl.keywords" value="none" and this goes in your web.config.
<activerecord isWeb="true">
<config>
<add key="connection.driver_class" value="NHibernate.Driver.MySqlDataDriver"/>
<add key="dialect" value="NHibernate.Dialect.MySQLDialect"/>
<add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<add key="connection.connection_string_name" value="BrochureDb"/>
<add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle"/>
<add key="hbm2ddl.keywords" value="none" />
</config>
</activerecord>
I just hit this issue as well. I ended up doing this:
http://orbitalcoder.wordpress.com/2009/08/18/proposed-solution-for-the-nhibernate-exception-column-reserved-word-does-not-belong-to-table-reservedwords/
which is a code change to NHibernate, but worked for me.
I got the same error but I'm using MySQL+NHibernate (2.1.0GA) + Mono (2.4) under Ubuntu and this link helped me, hope it works for you.
The key is to use this in session-factory
<property name="hbm2ddl.keywords">none</property>
https://forum.hibernate.org/viewtopic.php?f=25&t=997701
that was it :)
If doing it programmatically, you should do it as such:
cfg.SetProperty(NHibernate.Cfg.Environment.Hbm2ddlKeyWords, "none");
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:
FYI for any NHibernate/Fluent NHibernate newbies like myself, FCastellanos' solution worked for me as well (I got the error on Windows as well), and the Fluent NHibernate way to add that configuration is:
Fluently.Configure()
...
.ExposeConfiguration(c => c.Properties.Add("hbm2ddl.keywords", "none"))
...
.BuildSessionFactory()