Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-RC3
-
Fix Version/s: 2.0 final
-
Component/s: Persistence
-
Labels:None
-
Environment:Win7, JDK 1.6 u27
Description
totalCount doesn't recognize aliases (defined with createAlias) resulting in: org.hibernate.QueryException (could not resolve property ...)
I suspect it's because grails.orm.PagedResultList.getTotalCount() implementation doesn't add aliases of the original criteria instance to totalCriteria.
Please check the attachment.
In fact, it doesn't work with association querying either.
import org.hibernate.* def foos = Foo.createCriteria().list([max: 10, offset: 0]) { bar { eq('barName', 'John') } } println(foos.totalCount)