Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 2.0-RC2
-
Fix Version/s: None
-
Component/s: Persistence
-
Labels:
-
Environment:OS X
Description
An error is thrown whenever totalCount is called on a criteria object and order is specified either as a default sort order in the GORM mapping or if order is specified in the criteria itself. An error like the following is thrown:
Column "THIS_.DATE_CREATED" must be in the GROUP BY list; SQL statement: select count
as y0_ from post this_ order by this_.date_created desc limit ?
I've attached a sample project that shows this behavior with a criteria object. To reproduce this error, add two new Post objects and view the list to see the error.
-
Hide
- order.zip
- 29/Nov/11 7:12 PM
- 234 kB
- Craig Burke
-
- order/.classpath 0.8 kB
- order/.DS_Store 6 kB
- __MACOSX/order/._.DS_Store 0.1 kB
- order/.project 0.7 kB
- order/.../org.codehaus.groovy.eclipse.preferences.prefs 0.1 kB
- order/.../org.eclipse.wst.common.project.facet.core.xml 0.1 kB
- order/application.properties 0.2 kB
- __MACOSX/order/._application.properties 0.2 kB
- order/grails-app/.DS_Store 6 kB
- __MACOSX/order/grails-app/._.DS_Store 0.1 kB
- order/.../ApplicationResources.groovy 0.1 kB
- order/grails-app/conf/BootStrap.groovy 0.1 kB
- order/grails-app/conf/BuildConfig.groovy 2 kB
- order/grails-app/conf/Config.groovy 4 kB
- __MACOSX/order/.../conf/._Config.groovy 0.2 kB
- order/grails-app/conf/DataSource.groovy 1 kB
- order/grails-app/.../spring/resources.groovy 0.0 kB
- order/grails-app/conf/UrlMappings.groovy 0.2 kB
- order/grails-app/.../PostController.groovy 4 kB
- __MACOSX/order/.../._PostController.groovy 0.2 kB
- order/grails-app/domain/.DS_Store 6 kB
- __MACOSX/order/.../domain/._.DS_Store 0.1 kB
- order/grails-app/domain/com/.DS_Store 6 kB
- __MACOSX/order/.../com/._.DS_Store 0.1 kB
- order/grails-app/.../craigburke/Post.groovy 0.1 kB
- __MACOSX/order/.../craigburke/._Post.groovy 0.2 kB
- order/grails-app/.../messages.properties 3 kB
- order/.../messages_cs_CZ.properties 3 kB
- order/grails-app/.../messages_da.properties 3 kB
- order/grails-app/.../messages_de.properties 4 kB
Issue Links
- duplicates
-
GRAILS-8365
totalCount creates additional order by statement
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Hi Jeff,
I'm not sure this is actually a duplicate. This is different than the issue in RC1. In RC2 it actually throws an error instead of just returning an incorrect count.