Tom Carter
Tom Carter

Reputation: 2976

HQL query generates AntlrRuntime.NoViableAltException since NHibernate upgrade

I'm upgrading NHibernate from v 2.0 to 3.2. All our unit tests work Ok except for one which tries to execute the HQL query :

select  from SkillRequirementCoverage src  inner join src.Skill as skill  inner join src.User as user  inner join src.Job as job  left outer join skill.SkillDomain as skillDomain  where src.ApplicationId = ?  and user.Category = ?

which fails with the Antlr exception - it was working before.

The query is executed using HibernateTemplate.Find<T>(hqlRequest, parameters);

Anyone any idea ?

Upvotes: 0

Views: 535

Answers (1)

Tom Carter
Tom Carter

Reputation: 2976

The HQL parser in NH2.0 is less strict than in more recent versions. At least in NH3.2 a query should not start with a select if no column is specified. The following forms are valid:

from Entity e

select e from Entity e

select e.PropA from Entity e

Upvotes: 1

Related Questions