Jay
Jay

Reputation: 14471

nhibernate: can't determine data type of aggregate

Any suggestion how to fix this error? (I'd rather not create an sql view to skirt the issue with the sum aggregate)

"Can't extract the type of one parameter of a HQL function: expression->{TreatmentTime}; check aliases. [select new TherapyMinutesDisciplineByDayDTO( sum(TreatmentTime), 2.0, 3.0, t.TreatmentDate, p.LastName, d.Description ) from TherapyMinutesModule.TherapySession t join t._Patient p join t._Discipline d group by t.TreatmentDate, p.LastName, d.Description]"

Here's the hql:

                    c.HSQL = "select"
                     + " new TherapyMinutesDisciplineByDayDTO( sum(TreatmentTime), 2.0, 3.0, t.TreatmentDate, p.LastName, d.Description )"
                     + " from TherapySession t"
                     + " join t._Patient p"
                     + " join t._Discipline d"
                     + " group by t.TreatmentDate, p.LastName, d.Description"

Upvotes: 1

Views: 417

Answers (1)

anonymous
anonymous

Reputation: 6885

t.TreatmentTime?


Edit:

From comments below since my answer wasn't clear at all (sorry)

replace:

sum(TreatmentTime) 

with

sum(t.TreatmentTime)

Upvotes: 1

Related Questions