How do I handle database reserved words in NHibernate?
I have a NHibernate query like this "from Representative as R where R.Password = :pwd"
but I get an error saying that the query can't be executed because it has a reserved word in it.
The table field is indeed called "password" and it hasn't been a problem when inserting new registries, but now it's giving this error.
So I was wondering if there is a way in the mapping or in the query to indicate that it's a reserved word with brackets or apostrophes or something alike?
Status:
Open Mar 01, 2007 - 02:29 AM
Databases, NHibernate, .net
2answers
Answers
Mar 23, 2007 - 12:16 PM
I found out that I have to use the `-sign in the mapping files:
... column="`user`" ... for example
Jan 22, 2008 - 09:39 AM
The '-sign didn't work for me, I have a table named "User" in SQL Server 2005 and I had to use brackets to succeed, ex:
Thanks anyway.
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment