Recently, a colleague ran into a problem when he passed a named request in a single date parameter. In the query, the parameter was used twice, once in the expression and once in the GROUP BY clause. To our great surprise, we found that NHibernate used two variables and sent the same parameter twice, like @ p1 and @ p2. This behavior caused the SQL query to refuse the query because the usual “column in the select clause is not included in the group by clause” (I rephrase).
Is this normal behavior? Can this be changed? It seems to me that if you have a parameter name, for example: startDate, NHibernate needs to be passed only to @ p1 no matter how many times you could refer: startDate in the request.
Any comments?
The problem was resolved using another subquery to overcome the SQL parsing error.
Iant8 source
share