grails / gorm-hibernate5

GORM for Hibernate 5
Apache License 2.0
66 stars 71 forks source link

3.3.9 Can't find count method in createCriteria() #124

Open hanyou opened 5 years ago

hanyou commented 5 years ago
    def c = User.createCriteria()
    def queryString = "ilike('username', '%ad%')"
    def query = ParamsHelper.buildparams(params)
    def rows = c.list(offset: query.offset, max: query.limit) {
        queryString
        order(query.sort, query.order)
    }

    def total = c.count() {
        queryString
        order(query.sort, query.order)
    }
->> 211 invoke in org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker
188 invoke in org.grails.core.DefaultGrailsControllerClass
90 handle . . . . . in org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter
967 doDispatch in org.springframework.web.servlet.DispatcherServlet
901 doService . . . in ''
970 processRequest in org.springframework.web.servlet.FrameworkServlet
861 doGet . . . . . in ''
846 service in ''
55 doFilterInternal in org.springframework.boot.web.filter.ApplicationContextHeaderFilter
317 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
127 invoke . . . . . in org.springframework.security.web.access.intercept.FilterSecurityInterceptor
91 doFilter in ''
331 doFilter . . . . in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
114 doFilter in org.springframework.security.web.access.ExceptionTranslationFilter
64 doFilter . . . . in grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
54 doFilterInternal in grails.plugin.springsecurity.web.filter.GrailsHttpPutFormContentFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
54 doFilter . . . . in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
158 doFilter . . . . in org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
170 doFilter . . . . in org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
139 doFilter . . . . in grails.plugin.springsecurity.rest.RestAuthenticationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
200 doFilter . . . . in org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
64 doFilter . . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
82 doFilter . . . . in grails.plugin.springsecurity.rest.RestLogoutFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
105 doFilter . . . . in org.springframework.security.web.context.SecurityContextPersistenceFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
58 doFilter . . . . in grails.plugin.springsecurity.web.SecurityRequestHolderFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
214 doFilterInternal in org.springframework.security.web.FilterChainProxy
177 doFilter in ''
77 doFilterInternal in org.grails.web.servlet.mvc.GrailsWebRequestFilter
67 doFilterInternal in org.grails.web.filters.HiddenHttpMethodFilter
33 doFilterInternal in org.grails.plugins.springsession.web.http.HttpSessionSynchronizer
171 doFilterInternal in org.springframework.session.web.http.SessionRepositoryFilter
80 doFilter . . . . in org.springframework.session.web.http.OncePerRequestFilter
1149 runWorker in java.util.concurrent.ThreadPoolExecutor
624 run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 748 run in java.lang.Thread
Caused by IllegalArgumentException: call to [count] not supported here ->> 1607 invokeMethod in org.grails.orm.hibernate.query.AbstractHibernateCriteriaBuilder
28 list in UserController.groovy
211 invoke . . . . . in org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker
188 invoke in org.grails.core.DefaultGrailsControllerClass
90 handle . . . . . in org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter
967 doDispatch in org.springframework.web.servlet.DispatcherServlet
901 doService . . . in ''
970 processRequest in org.springframework.web.servlet.FrameworkServlet
861 doGet . . . . . in ''
846 service in ''
55 doFilterInternal in org.springframework.boot.web.filter.ApplicationContextHeaderFilter
317 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
127 invoke . . . . . in org.springframework.security.web.access.intercept.FilterSecurityInterceptor
91 doFilter in ''
331 doFilter . . . . in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
114 doFilter in org.springframework.security.web.access.ExceptionTranslationFilter
64 doFilter . . . . in grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
54 doFilterInternal in grails.plugin.springsecurity.web.filter.GrailsHttpPutFormContentFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
54 doFilter . . . . in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
158 doFilter . . . . in org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
170 doFilter . . . . in org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
139 doFilter . . . . in grails.plugin.springsecurity.rest.RestAuthenticationFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
200 doFilter . . . . in org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
64 doFilter . . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
82 doFilter . . . . in grails.plugin.springsecurity.rest.RestLogoutFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
105 doFilter . . . . in org.springframework.security.web.context.SecurityContextPersistenceFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
58 doFilter . . . . in grails.plugin.springsecurity.web.SecurityRequestHolderFilter
331 doFilter in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
214 doFilterInternal in org.springframework.security.web.FilterChainProxy
177 doFilter in ''
77 doFilterInternal in org.grails.web.servlet.mvc.GrailsWebRequestFilter
67 doFilterInternal in org.grails.web.filters.HiddenHttpMethodFilter
33 doFilterInternal in org.grails.plugins.springsession.web.http.HttpSessionSynchronizer
171 doFilterInternal in org.springframework.session.web.http.SessionRepositoryFilter
80 doFilter . . . . in org.springframework.session.web.http.OncePerRequestFilter
1149 runWorker in java.util.concurrent.ThreadPoolExecutor
624 run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 748 run in java.lang.Thread
jameskleeh commented 5 years ago

Which GORM implementation? Edit: n/m I see hibernate in the stacktrace