tags:

views:

39

answers:

1

So the below hql query is throwing an Antlr.Runtime.NoViableAltException. I was able to determine that issue is with the member.LastName field in the order by clause. If remove member.LastName from the order by the query will execute. This HQL worked just fine in an earlier version of NHibernate, but it broke with the upgrade to NHibernate 2.1.2.4. How can I include the member.LastName property without throwing an exception? Any help is greatly appreciated. Thanks!

select chartAssignmentLogRecord 
from ChartAssignmentLogRecord chartAssignmentLogRecord 
inner join chartAssignmentLogRecord.Measure as measure 
inner join measure.ProviderLocation as providerLocation
inner join providerLocation.Provider as provider 
inner join providerLocation.Address as address 
inner join measure.Member as member
where chartAssignmentLogRecord.AssignedDate >= :startDate  and chartAssignmentLogRecord.ChartModifiedStatus =  :modifiedStatus  and chartAssignmentLogRecord.AssignedDate =(select max(subChartAssignmentLogRecord.AssignedDate) from ChartAssignmentLogRecord subChartAssignmentLogRecord where subChartAssignmentLogRecord.Measure=chartAssignmentLogRecord.Measure) 
order by chartAssignmentLogRecord.AssignedDate desc, provider.LastName, address.AddressLine1, member.LastName
+1  A: 

Thanks to DanP, I used measure.Member.LastName instead of member.LastName in the order by clause. Not sure why this fixed it, since as far as I know, my HQL should have been valid and definitely was valid in earlier versions of NHibernate.

Darren