R – NHibernate HQL Group by Entity

hqlnhibernate

Is it possible to run a query similar to this one in HQL without having to specify all of the column names.

select med, MAX(med.PrescriptionLines.Prescription.PrescriptionDate)
    from Medication med
    where med.Patient.PatientId = :patientId
    group by med

This query expands out all of the properties of the Medication object in the select, but in the group by only expands med to be med.MedicationId. I don't want to have to specify all of the properties of the medication object in the group by clause. Is there a way to do it?

I've tried replacing the group by med with group by med.* or group by {med.*} but that doesn't work.

Any ideas?

Best Answer

Related Topic