Error in JPQL query

1

When I am starting my server, the following unexpected token error is occurring:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IServidorMensalRepositorio': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException:
 Validation failed for query for method public abstract java.lang.Long br.com.governa.rh.persistencia.repositorio.IServidorMensalRepositorio.findQuantidadeRegistroPesquisa(java.lang.Long,java.lang.String,ja
va.lang.String,java.lang.String,java.util.Date,java.lang.String,java.util.List,java.lang.Integer,java.lang.Long)!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:787)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:434)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:779)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:284)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1322)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:731)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:490)
    at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:280)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.server.Server.start(Server.java:342)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
    at org.eclipse.jetty.server.Server.doStart(Server.java:290)
    at org.eclipse.jetty.maven.plugin.JettyServer.doStart(JettyServer.java:68)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:563)
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:359)
    at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:167)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.lang.Long br.com.governa.rh.persistencia.repositorio.IServidorMensalRepositorio.findQuantidadeRegis
troPesquisa(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.util.Date,java.lang.String,java.util.List,java.lang.Integer,java.lang.Long)!
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:92)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:62)
    at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:72)
    at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:53)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:136)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:204)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:73)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:347)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
    ... 61 more
Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: % near line 1, column 301 [SELECT COUNT(*) FROM br.com.governa.rh.comum.entidade.Servido
rMensal serMensal WHERE serMensal.mesReferencia = :mesReferencia  and serMensal.servidor.empresa.id = :idEmpresa  and (serMensal.servidor.matricula = :matricula OR :matricula = 0) and trim(upper(serMensal.s
ervidor.pessoaFisica.nome)) like %:nome%  and trim(upper(serMensal.servidor.pessoaFisica.nomeMae)) like %:nomeMae%  and trim(upper(serMensal.servidor.pessoaFisica.cpf)) like %:cpf%  and trim(upper(serMensal
.situacao)) in :situacaoFuncional and (serMensal.servidor.pessoaFisica.dataNascimento = :dataNascimento OR :dataNascimentoStr = null) ]
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1750)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:331)
    at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344)
    at com.sun.proxy.$Proxy74.createQuery(Unknown Source)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:86)
    ... 74 more
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: % near line 1, column 301 [SELECT COUNT(*) FROM br.com.governa.rh.comum.entidade.ServidorMensal serMensal WHERE serMensal.me
sReferencia = :mesReferencia  and serMensal.servidor.empresa.id = :idEmpresa  and (serMensal.servidor.matricula = :matricula OR :matricula = 0) and trim(upper(serMensal.servidor.pessoaFisica.nome)) like %:n
ome%  and trim(upper(serMensal.servidor.pessoaFisica.nomeMae)) like %:nomeMae%  and trim(upper(serMensal.servidor.pessoaFisica.cpf)) like %:cpf%  and trim(upper(serMensal.situacao)) in :situacaoFuncional an
d (serMensal.servidor.pessoaFisica.dataNascimento = :dataNascimento OR :dataNascimentoStr = null) ]
    at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:91)
    at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:109)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:304)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
    at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328)
    ... 80 more

pom.xml:

<dependencies>

        <!-- GOVERNA ADMIN COMUM -->
        <dependency>
            <groupId>br.com.governa.admin</groupId>
            <artifactId>governa-admin-comum</artifactId>
            <version>${governa.admin.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate.javax.persistence</groupId>
                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
            </exclusions>

        </dependency>

        <!-- GOVERNA ADMIN PERSISTENCIA -->
        <dependency>
            <groupId>br.com.governa.admin</groupId>
            <artifactId>governa-admin-persistencia</artifactId>
            <version>${governa.admin.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate.javax.persistence</groupId>
                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- GOVERNA ADMIN NEGOCIO -->
        <dependency>
            <groupId>br.com.governa.admin</groupId>
            <artifactId>governa-admin-negocio</artifactId>
            <version>${governa.admin.version}</version>
        </dependency>

        <!-- GOVERNA ADMIN GERADOR -->
        <dependency>
            <groupId>br.com.governa.admin</groupId>
            <artifactId>governa-admin-gerador</artifactId>
            <version>${governa.admin.version}</version>
        </dependency>

        <!-- GOVERNA ADMIN TESTE -->
        <dependency>
            <groupId>br.com.governa.admin</groupId>
            <artifactId>governa-admin-teste</artifactId>
            <version>${governa.admin.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- GOVERNA ADMIN SISTEMA ARQUIVO -->
        <dependency>
            <groupId>br.com.governa.admin</groupId>
            <artifactId>governa-admin-sistema-arquivo</artifactId>
            <version>${governa.admin.version}</version>
        </dependency>

        <!-- GOVERNA RH CÁLCULO -->
        <dependency>
            <groupId>br.com.governa.rh</groupId>
            <artifactId>governa-rh-calculo</artifactId>
            <version>${governa.rh.version}</version>
        </dependency>

        <!-- GOVERNA RH TESTE -->
        <dependency>
            <groupId>br.com.governa.rh</groupId>
            <artifactId>governa-rh-teste</artifactId>
            <version>${governa.rh.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- GOVERNA RH NEGOCIO -->
        <dependency>
            <groupId>br.com.governa.rh</groupId>
            <artifactId>governa-rh-comum</artifactId>
            <version>${governa.rh.version}</version>
        </dependency>

        <!-- GOVERNA RH PERSISTENCIA -->
        <dependency>
            <groupId>br.com.governa.rh</groupId>
            <artifactId>governa-rh-persistencia</artifactId>
            <version>${governa.rh.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate.javax.persistence</groupId>
                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- GOVERNA RH NEGOCIO -->
        <dependency>
            <groupId>br.com.governa.rh</groupId>
            <artifactId>governa-rh-negocio</artifactId>
            <version>${governa.rh.version}</version>
        </dependency>

        <!-- GOVERNA RH MAPEAMENTO -->
        <dependency>
            <groupId>br.com.governa.rh</groupId>
            <artifactId>governa-rh-mapeamento</artifactId>
            <version>${governa.rh.version}</version>
        </dependency>

        <!-- GOVERNA RHLEGADO MAPEAMENTO -->
        <dependency>
            <groupId>br.com.governa.rhlegado</groupId>
            <artifactId>governa-rhlegado-mapeamento</artifactId>
            <version>${governa.rhlegado.version}</version>
        </dependency>

        <!-- GOVERNA PONTO TESTE -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>governa-ponto-teste</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- GOVERNA PONTO COMUM -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>governa-ponto-comum</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- GOVERNA PONTO PERSISTENCIA -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>governa-ponto-persistencia</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- GOVERNA PONTO WEB -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>governa-ponto-web</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- GOVERNA PONTO NEGOCIO -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>governa-ponto-negocio</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- GOVERNA PONTO RHLEGADO -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>governa-ponto-rhlegado</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- COMMONS LANG -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.3.2</version>
        </dependency>


        <!-- SPRING CORE -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- SPRING CONTEXT -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- SPRING TX -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <!-- SPRING WEB -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- SPRING WEB -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>   

        <!-- SPRING DATA JPA -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.8.0.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- SPRING JDBC -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <!-- SPRING AOP -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <!-- XML SEC -->
        <dependency>
            <groupId>org.apache.santuario</groupId>
            <artifactId>xmlsec</artifactId>
            <version>1.5.5</version>
        </dependency>

        <!-- SPRING SECURITY CONFIG -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <!-- SPRING SECURITY CORE -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-expression</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- SPRING SECURITY CAS CLIENT -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-cas-client</artifactId>
            <version>${spring.security.cas.client.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-web</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- SPRING SECURITY WEB -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring.security.version}</version>
        </dependency>   

        <!-- SPRING EXPRESSION -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <!-- DEPENDENCY FOR SPRING AOP -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>3.1</version>
        </dependency>

        <!-- JTDS -->
        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
            <version>1.3.1</version>
        </dependency>

        <!-- SERVLET API -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>


        <!-- JAVAX INJECT -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- JSF API -->
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${jsf.version}</version>
        </dependency>

        <!-- JSF IMPLEMENTATION -->
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>${jsf.version}</version>
        </dependency>

        <!-- PRIME FACES -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>5.1</version>
        </dependency>

        <!-- PRIME FACES EXTENSIONS -->
        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>primefaces-extensions</artifactId>
            <version>3.0.0</version>
        </dependency>

        <!-- PRIMEFACES THEME -->
        <dependency>
            <groupId>org.primefaces.themes</groupId>
            <artifactId>all-themes</artifactId>
            <version>1.0.10</version>
        </dependency>

        <!-- JPA-2.1-API -->
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>

        <!-- HIBERNATE CORE -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <!-- HIBERNATE VALIDATOR -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.1.1.Final</version>
        </dependency>           

        <!-- HIBERNATE ENTITY MANAGER -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <!-- C3P0 CONNECTION POOL FOR HIBERNATE -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <!-- POSTGRESQL -->
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
        </dependency>

        <!-- SQL Server JDBC -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>4.0</version>
        </dependency>

        <!-- OJDBC -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.1.0</version>
        </dependency>

        <!-- OPEN SAML -->
        <dependency>
            <groupId>org.opensaml</groupId>
            <artifactId>opensaml</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>

However, when I run the unit test of my query, it runs normally without errors. Can anyone help me?

    
asked by anonymous 05.05.2015 / 21:54

1 answer

2

From the error, it looks like there was a few quotes in your query: Error Message:

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: % near line 1, column 301 [SELECT COUNT(*) FROM br.com.governa.rh.comum.entidade.ServidorMensal serMensal WHERE serMensal.mesReferencia = :mesReferencia  and serMensal.servidor.empresa.id = :idEmpresa  and (serMensal.servidor.matricula = :matricula OR :matricula = 0) and trim(upper(serMensal.servidor.pessoaFisica.nome)) like %:nome%  and trim(upper(serMensal.servidor.pessoaFisica.nomeMae)) like %:nomeMae%  and trim(upper(serMensal.servidor.pessoaFisica.cpf)) like %:cpf%  and trim(upper(serMensal.situacao)) in :situacaoFuncional and (serMensal.servidor.pessoaFisica.dataNascimento = :dataNascimento OR :dataNascimentoStr = null) ]

As I believe the query should have been:

SELECT COUNT(*) 
  FROM br.com.governa.rh.comum.entidade.ServidorMensal serMensal 
 WHERE serMensal.mesReferencia = :mesReferencia  
   and serMensal.servidor.empresa.id = :idEmpresa  
   and (serMensal.servidor.matricula = :matricula OR :matricula = 0) 
   and trim(upper(serMensal.servidor.pessoaFisica.nome)) like '%' + :nome + '%'  
   and trim(upper(serMensal.servidor.pessoaFisica.nomeMae)) like '%' + :nomeMae + '%' 
   and trim(upper(serMensal.servidor.pessoaFisica.cpf)) like '%' + :cpf + '%'  
   and trim(upper(serMensal.situacao)) in (:situacaoFuncional) 
   and (serMensal.servidor.pessoaFisica.dataNascimento = :dataNascimento OR :dataNascimentoStr = null)

Although this part seems strange to me:

and (serMensal.servidor.pessoaFisica.dataNascimento = :dataNascimento OR :dataNascimentoStr = null)
    
11.05.2015 / 22:01