首页 > 代码库 > unexpected token: null near line 1, column 290

unexpected token: null near line 1, column 290

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: null near line 1, column 290 [select count(*) from cn.com.taiji.sample.entity.User t where 1=1 and (t.name like :userName or t.namePy like :userName or t.loginName like :userName and t.status =:status and not exists(select b.user from cn.com.sample.entity.UserRole b where b.role.id =:roleId and b.user.id = t.id)]

这是我报的错误,报错的原因属于语法格式的错误,整个HQL语句也在这里,结合网上查找的解决办法,总结如下:

1、多余的空格;

2、字符串引号应该为单引号;

3、=:应该是在一起的,中间没有空格,‘like :’中介需要有空格,其实这里没这么严谨,只是以防万一;

4、括号,我出的问题就是左括号比右括号多了一个;

可能还有其他原因,希望对大家有帮助!

unexpected token: null near line 1, column 290