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、括号,我出的问题就是左括号比右括号多了一个;
5、一条SQL或者HQL语句中只能有一个order by(在没有子查询的前提下),所以如果有多个需要参照的排序条件,那么就在order by后加上,每个条件之间用逗号隔开,比如:
from Topic t order by t.postTime desc,t.lastUpdatedTime asc;
可能还有其他原因,希望对大家有帮助!
unexpected token: null near line 1, column 290的更多相关文章
- Hibernate实现limit查询报错 :unexpected token: limit near line 1, column 33 [from pojo.Product p order by id limit ?,? ]
原因: hibernate无法识别limit, hql语句更不能这样写String hql="from Product p order by id limit ?,? "; 解决 ...
- 【Unity Shader】syntax error: unexpected token 'struct' at line x 错误解决办法
以下代码处出现了syntax error: unexpected token 'struct' at line 33的错误 struct a2v { float4 vertex_position : ...
- 执行shell脚本提示“syntax error near unexpected token for((i=0;i<$length;i++))”
sh脚本例如以下: #!/usr/bin/env bash county="3 4 5 6 7 8 9 10 11 12 16 29 39 44 53 62 72 84 97 115 128 ...
- linux后台执行./run.py提示python syntax error near unexpected token `('
python脚本中的#!/usr/bin/python 估计有不少人注意过一些python脚本开头有这么行东东: #!/usr/bin/python 它是用来干嘛的?貌似没有它对脚本功能也没啥 ...
- shell出现syntax error near unexpected token `<' 解决方法
最新在看一个shell资料时,按照教材,却出现如下错误,不能运行 如下,简单的脚本: #!/bin/bash cat |while read line do echo $line done < ...
- SSH框架-unexpected token: * near line 1, column 8 [select * from tb_chaper where course_id = 2];报错解决方法
SSH项目,访问jsp页面出现报错,控制台显示报错信息: org.springframework.orm.hibernate3.HibernateQueryException: unexpected ...
- Linix登录报"/etc/profile: line 11: syntax error near unexpected token `$'{\r''"
同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登 ...
- FreeMarker template error: The following has evaluated to null or missing: ==> blogger.md [in template "admin/about.ftl" at line 44, column 84]
FreeMarker template error:The following has evaluated to null or missing:==> blogger.md [in templ ...
- -bash: /etc/profile: line 11: syntax error near unexpected token `$'{\r''报错问题解决
在Linux系统配置Java环境变量之后执行 source /etc/profile指令报:-bash: /etc/profile: line 11: syntax error near unexpe ...
随机推荐
- 调magento自定义模板发邮件
1. 设置邮件模板 <global> <template> <email> <custom_email_template1 module="Samp ...
- SQL 数据类型、约束、索引及视图
一.数据类型:整数:int,bigint,smallint小数:float,real,decimal(长度,精度),numeric(长度,精度)字符:char(n),varchar(n) 8000英文 ...
- 基于jQuery实现的水平和垂直居中的div窗口
在建立网页布局的时候,我们经常会面临一个问题,就是让一个div实现水平和垂直居中,虽然好几种方式实现,但是今天介绍时我最喜欢的方法,通过css和jQuery实现. 1.通过css实现水平居中: 复 ...
- Schema-based AOP support
本文参考至:spring-framework-reference.pdf的7.3 章节 [Schema-based AOP support] If you are unable to use Java ...
- unity读取Sqlite数据库
using UnityEngine; using System.Collections; using Mono.Data.Sqlite; using System.Data; public enum ...
- Android viewpager 嵌套 viewpager滑动 点击事件冲突解决方案
为了解决这个问题.可以自定义viewpager,然后在里面监听首饰,自定义点击事件 package com.hpuvoice.view; import android.content.Context; ...
- 3D模型选中显示样式改变
osg::ref_ptr<osg::Material> material = new osg::Material(); //模型材质信息 material->setTranspare ...
- Python 模块的一般处理
因为Python模块在被导入时,定义在模块中的顶级代码是会被执行的!如果我们想改变这种运行方向可以这样做: if __name__ == '__main__':#当这个模块作为主程序时__name__ ...
- LBYL与EAFP两种防御性编程风格
检查数据可以让程序更健壮,用术语来说就是防御性编程. 检查数据的时候,有这样的两种不同的风格. LBYL:Look Before You Leap EAFP:It's Easier to Ask ...
- VC中实现带有背景位图的树型控件
当前许多应用程序都在使用树型控件时为其添加了背景位图,增强的控件的魅力,然而对于Visual C++编程爱好者来说,使用Visual C++MFC提供的树型控件(CTreeCtrl)本身就是一个难点, ...