|
There are already some posts elsewhere which list the cause of this error as having the <query/> or <sql-query/> tag inside the <class/> tag in the mapping - Move your <query/> tag outside the <class/> tag and all is well - BUT... this didn't work for me!
After several hours of debugging, I finally worked out what was wrong - I'd given one of my mapping files the wrong extension. I usually use (.hbm.xml) rather than simply (.hbm) so that visual studio more easily recognises them as XML files. BUT.. on one of my files I'd simply used a (.xml) extention by mistake, and didn't spot this as they all end in (.xml).
Because NH didn't recognise the file extension, it didn't even compile it in at application start, so when I tried to perform a GetNamedQuery() it didn't have a clue what I was on about.
If you get this error message, check the name of your mapping file FIRST before going looking for a more complicated cause of failure.
Regards
Simon
|