【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 ...
随机推荐
- GIMP矩形选框预圆形选框
矩形选框,四种框选模式,了解一下 Repalace the current selector Add to the current selection (shift键) Subtract from t ...
- 避免使用aireplay-ng指令时出现AP通道不对的方法
本方法搜集网络:具体使用为在调试网卡为监听模式,使用airodump-ng指令扫描wifi后,需要先执行"airmon-ng stop wlan0"指令,然后再进行一系列抓包等操作 ...
- Java基础知识:集合框架
*本文是最近学习到的知识的记录以及分享,算不上原创. *参考文献见链接. 目录 集合框架 Collection接口 Map接口 集合的工具类 这篇文章只大致回顾一下Java的总体框架. 集合框架 ht ...
- vscode python code-runner 中文乱码解决
https://www.cnblogs.com/zhaoshizi/p/9050768.html 这里我使用的是第二种方法
- python算法-插入排序
插入排序 一.核心思想:在一个有序的数组中,通过逐一和前面的数进行比较,找到新数的位置. 例子:数组有有一个数21 插入一个3,3<21,因此结果为 3,21 再插入一个34,34>21, ...
- Mac版有道云笔记不能自动同步
删除本地资源文件夹 /Users/xxxx/Library/Containers/com.youdao.note.YoudaoNoteMac 直接删除整个文件夹,之后重新登录账号.
- Leetcode 376.摆动序列
摆动序列 如果连续数字之间的差严格地在正数和负数之间交替,则数字序列称为摆动序列.第一个差(如果存在的话)可能是正数或负数.少于两个元素的序列也是摆动序列. 例如, [1,7,4,9,2,5] 是一个 ...
- 浏览器BOM模型
百度百科:浏览器对象模型(BrowserObjectModel) 主要功能 1. 弹出新浏览器窗口的能力: 2. 移动.关闭和更改浏览器窗口大小的能力: 3. 可提供WEB浏览器详细信息的导航对象: ...
- PTA 10-排序5 PAT Judge (25分)
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/677 5-15 PAT Judge (25分) The ranklist of PA ...
- 多重部分和 poj1742
Description People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar. ...