Reserved words not auto-mapped
Hello,
It appears like the latest version 1.0 RTM is not mapping the reserved words properly. For example I have a field "Order" and I get an error back from NHibernate about it. Looking at the generated xml file here is the culprit:
<column name="Order" />
With my limited knowledge of NHibernate I believe this field should be surrounded by `?
Thanks.
Comments are currently closed for this discussion. You can start a new one.
2 Posted by fe1337 on 14 Mar, 2010 11:31 PM
Just FYI, I also have the same problems with fields named "From" and "To".
Support Staff 3 Posted by Paul Batum on 15 Mar, 2010 11:28 AM
You should try downloading one of the more recent builds.
https://fluentnhibernate.org/downloads
4 Posted by fe1337 on 15 Mar, 2010 01:36 PM
I got build #632 and that didn't help, I have the same problem.
Support Staff 5 Posted by James Gregory on 17 Mar, 2010 10:38 AM
We don't auto-quote column names because not all database dialects/drivers in NHibernate support it. You need to do this yourself.
There are several options, firstly you could use the hbm2ddl.keywords setting if your database supports it. Secondly, you could create a convention (probably an
IColumnConvention
) to change the name of the columns and quote them yourself. You've not said whether you're using automapping or not, if you aren't there's also the option of specifying the columns explicitly in your mappings.6 Posted by fe1337 on 17 Mar, 2010 09:40 PM
I'm using automapping. I will have a look at your suggestions. I'm surprised that Paul's answer seemed to acknowledge an issue by advising me to download the latest version, while you're saying that this is in fact normal behavior.
Thanks.
Support Staff 7 Posted by Paul Batum on 17 Mar, 2010 10:51 PM
Basically there's been ALOT of changes since the RTM, including some aspects of auto-quote behavior. It can be pretty difficult to remember how the RTM is behaving so as a rule when someone starts a support request with "I'm on the RTM and..." I will tell them to get a later build - if they still have an issue after doing that, assisting them will be all the easier once we know they have the latest changes.
Sorry if you felt like I misled you.
8 Posted by Joseph LeBlanc on 12 Apr, 2010 06:26 PM
I'm having the exact same issue. Can someone post an esample of how to use IColumnConvention? I can't seem to figure it out and can't find any examples anywhere.
9 Posted by Joseph LeBlanc on 13 Apr, 2010 05:00 PM
I figured it out.
Paul Batum resolved this discussion on 25 Apr, 2010 01:54 PM.