NHibernate.QueryException: unexpected token: as [from mytable as m…

5.May.08 – 8:58

Today i encountered a strange behaviour with NHibernate. The error message in the headline was kinda confusing. I spent some time on google and everything i found was that my mapping is probably wrong or contains some bugs though i knew my mapping was definitely correct.

Some time later i found out what made this error appear. When you have a lot of entities and therefore a huge mapping, it can take quite a long time to process your hbm file. When you now want to access some of your entities from another thread as the main thread via NHibernate, but NHibernate still has not finished processing your mapping, then you’ll also get the error stated above.This will remain as long as you use the same session.

Maybe this can save some other guy’s time ;)

Post a Comment

Comment spam protected by SpamBam