Craig Ringer edited a comment on Bug JPA-34

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 to me. Looks like a bug to me.

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