【spring boot jpa】hql语句报错 :antlr.NoViableAltException: unexpected token: roleName
使用场景:在spring data jpa下使用@Query("hql语句")
然后在项目启动的时候报错
hql语句报错:antlr.NoViableAltException: unexpected token: roleName
仔细查看了一下代码:
@Query(value =
"from Role as r left join r.department as d left join d.company as c where" +
" (:departmentId is null or d.id = :departmentId)" +
" and (:companyId is null or c.id = :companyId)"+
" and (:roleName is null or r.name = :roleName)"
)
fun searchRole(
@Param("departmentId") departmentId: Long? = null,
@Param("companyId") companyId: Long? = null,
@Param("roleName") roleName: String? = null
): Set<Role>

问题所在:
roleName本身确实没有问题,但是它边上的(括号确实有问题
发现它跟前的括号缩紧和上面的括号缩进不一样,好吧 真恶心
解决问题:
把:roleName附近的中文括号替换成英文括号,问题解决。
【spring boot jpa】hql语句报错 :antlr.NoViableAltException: unexpected token: roleName的更多相关文章
- spring boot jpa 使用update 报错解决办法
在spring boot jpa 中自定义sql,执行update操作报错解决办法: 在@Query(...)上添加 @Modifying@Transactional注解
- Spring Boot JPA分页 PageRequest报错
在使用Spring Boot JPA分页 PageRequest分页时,出现如下错误: 本来以为是包导入出现了问题,结果发现并不是.导入包如下: 后来在网上查找相关资料,发现这样的用法,好像也可以用, ...
- spring boot启动STS 运行报错 java.lang.NoClassDefFoundError: ch/qos/logback/classic/LoggerContext
spring boot启动STS 运行报错 java.lang.NoClassDefFoundError: ch/qos/logback/classic/LoggerContext 学习了: http ...
- jquery使用ajax报错[Uncaught SyntaxError: Unexpected token :]
$.post('/ajax/validate.do',{"id": id},function(ret){ //ret }); 返回值明明是json,格式也是正确的,却解析不成功,在 ...
- vue - public 引入 <script>报错 Uncaught SyntaxError: Unexpected token '<'
1.现象 原本我是直接在母版引入 <script type="application/javascript" src="static/config.js" ...
- Apache Hive 执行HQL语句报错 ( 10G )
# 故障描述: hive > , ) as uuid, count(distinct(request_body["uuid"])) as count from log_bft ...
- 【spring data jpa】启动报错:nested exception is java.util.NoSuchElementException
spring boot项目中 使用spring data jpa 启动报错: org.springframework.beans.factory.UnsatisfiedDependencyExcept ...
- 使用Spring boot整合Hive,在启动Spring boot项目时,报错
使用Spring boot整合Hive,在启动Spring boot项目时,报出异常: java.lang.NoSuchMethodError: org.eclipse.jetty.servlet.S ...
- 【spring cloud】【spring boot】项目启动报错:Cannot determine embedded database driver class for database type NONE
解决参考文章:https://blog.csdn.net/hengyunabc/article/details/78762097 spring boot启动报错如下: Error starting A ...
随机推荐
- http常用状态吗以及分别代表什么意思?
http常用状态码: 状态码 定义 说明 1xx 信息 街道请求继续处理 2xx 成功 成功的收到.理解.接受 3xx 重定向 浏览器需要执行某些特殊处理一完成请求 4xx 客户端错误 请求的语法有问 ...
- 简易的mysql性能查询脚本
#!/bin/bash mysqladmin -P3306 -uroot -p -h127. -r -i ext |\ awk -F"|" \ "BEGIN{ count ...
- 文件操作-touch
本文来给大家介绍另外一个比较常用的命令--touch命令,Linux touch命令 主要用来修改文件或者目录的时间属性,或者建立新文件. 转载自https://www.linuxdaxue.com/ ...
- nw335 debian sid x86-64 -- 5 使用xp的驱动
nw335 debian sid x86-64 -- 5 使用xp的驱动
- centos 安装 yum apt
以下地址 http://download.csdn.NET/detail/mimi00x/8081263 执行安装命令 rpm -i rpmforge-release-0.5.3-1.el7.rf.x ...
- linux 搭建apache 服务器
1.查看apache服务器 /etc/init.d/httpd status 若没有,则使用yum -y install httpd 安装软件 2.设置开机启动 chkconfig httpd o ...
- python算法-快速排序
快速排序: 学习快速排序,要先复习下递归: 递归的2个条件: 1. 函数自己调用自己 2.有一个退出的条件 练习:基于递归下一个函数,计算n!并且求出当n等于10的值. n!=n * n-1*…..* ...
- xtu数据结构 B. Get Many Persimmon Trees
B. Get Many Persimmon Trees Time Limit: 1000ms Memory Limit: 30000KB 64-bit integer IO format: %lld ...
- 【Python】SyntaxError: Non-ASCII character '\xe8' in file
遇到的第一个问题: SyntaxError: Non-ASCII character '\xe8' in file D:/PyCharmProject/TempConvert.py on line 2 ...
- Flutter 发布APK时进行代码/资源混淆的坑
Flutter 发布APK时进行代码/资源混淆的坑 @author ixenos 1. 关键点 proguard是Java的代码混淆工具,但是当用第三方库的时候,必须要告诉proguard不要检查,因 ...