I’n using NHibernate 1.2.0 and cannot migrate to a newer version.
1.2.0 does not allow me to do Restrictions so that I can replace empty strings with nothing.
I am trying to do the following using CreateQuery
SELECT Col1, COl2 FROM [Employee].[MyTable] WHERE REPLACE(Col1, " ", "") = 'IWANTTHIS'
Somehow NHibernate does not like [Employee].[MyTable]
Is there any other way I can do this or fix what I am doing? I have not idea! Please help
CreateQueryis for performing HQL queries – which are written as queries of objects, not DB tables.From the looks of your example you want to do an SQL query, so
CreateSQLQuerywould be the one to use.However, in my opinoin you should seriously think about rewriting this using ICriteria or HQL. Is there wny reason shy you have to specify the low level SQL?