SpringSource/spring-data-jpa — pull request #29 by thomasdarimont (2013-07-25 15:55:32+00:00)
Title: DATAJPA-377 - Remove unnecessary "order by"-part from generated count qu...

...ery.

Adjusted createCountQueryFor in QueryUtils to leave out the order by part in the generated query. This avoids problems with databases that require columns specified in the order by clause to be in the select / group by list for count queries (e.g. H2).
In addition to that this should give us a little performance boost if the database did not already optimise the query execution.
Added test case removesOrderByInGeneratedCountQueryFromOriginalQueryIfPresent.