For testSimplyfiedGroupByObject, Hibernate is producing the query:
select dbobject1_.id as id0_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobjectac0_.object_id;
where the correct formulation is:
select dbobject1_.id as id0_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobject1_.id;
The only change is that the GROUP BY references the other side of the join condition, the side mentioned in the SELECT list.
This remains the case even if I rephrase the test to explicitly group by the DBObject side:
Maybe some RDBMSes infer that the two fields are the same because of the `INNER JOIN` and implicitly transform the first statement into a `GROUP BY` on the `id` of `DBObject`? Or maybe this is just a Pg dialect bug.
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
For testSimplyfiedGroupByObject, Hibernate is producing the query:
select dbobject1_.id as id0_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobjectac0_.object_id;
where the correct formulation is:
select dbobject1_.id as id0_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobject1_.id;
The only change is that the GROUP BY references the other side of the join condition, the side mentioned in the SELECT list.
This remains the case even if I rephrase the test to explicitly group by the DBObject side:
Path<DBObject> object = from.get(DBObjectAccessCounter_.object); Path<Long> objectId = object.get(DBObject_.id); query.groupBy(objectId).select(object);
which seems dead wrong. Looks like a bug to me.
Maybe some RDBMSes infer that the two fields are the same because of the `INNER JOIN` and implicitly transform the first statement into a `GROUP BY` on the `id` of `DBObject`? Or maybe this is just a Pg dialect bug.