I'm having difficulties with NHibernate and a simple GROUP BY expression.
I have a table with records of user activity. I need to return the latest activity row for each user, sorted by Time descending, which also corresponds to descending IDs (autoincrement).
Basically, this is the SQL I want to run:
SELECT * FROM log_user_activity GROUP BY UserID DESC
I searched SO for an similar question and got a bunch of answers with projections, subqueries, DTOs...
Is there any simple way this can be done, without defining a new DTO class, or using a projection with anonymous object where I have to manually specify all the columns again? A solution using QueryOver syntax would be preferable, but not mandatory.