With many HQL queries, time and time again I am getting this exception:
Antlr.Runtime.NoViableAltException
This is really generic and unhelpful - does anyone know how best to debug this? Obviously it's a problem with my HQL - but without any clue as to what exactly is wrong it's very much a case of trial and error. I'm pulling my hair out every time I see this.
Note, I don't want to post any HQL here, becuase it's something that I am often coming across, not a problem related to one query.
Does anyone know the best way to tackle this? Is there any tool for validating HQL queries?
Have a look at NHibernate Query Analyzer. It is not perfect, but it will be helpful in many situations.
I can't help you directly, here's something I can share.
When dealing with hibernate or nhibernate (NH), I generally debug by enabling logging on the nhibernate's log4net, or/and the logging of queries at the DB side (e.g. mysql).
They can tell me what is the queries being formulated and executed at the DB and what are the exceptions thrown back by the DB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With