执行hibernate报错“node to traverse cannot be null”问题的解决
来源:互联网 发布:java final修饰方法 编辑:程序博客网 时间:2024/06/03 15:05
使用hibernate执行HQL,有时候会报错:
java.lang.IllegalArgumentException: node to traverse cannot be null!
一般来说,这是由于使用hibernate 中的HQL做查询时出现了空返回值的错误,很有可能HQL语句本身就写错了,比如:
String Finder = new String("update set bean.test=bean.test+:value");Query query = getSession().createQuery(Finder);
此处会报错,是因为HQL中没有说明数据表的名称,把名称加上:
String Finder = new String("update TestTable bean set bean.test=bean.test+:value");Query query = getSession().createQuery(Finder);
就正确了。
还有一种情况就是在query接口创建引用的时候,本意是引用配置文件中的HQL语句却大意写成了创建,
<!--user.editpassword就是相当于queryName--> <query name="user.editpassword"> UPDATE User SET password = ? WHERE id = ? </query>
public void executeUpdate(String queryName, Object... objects) { Session session = this.getSessionFactory().getCurrentSession();正确: Query query = session.getNamedQuery(queryName);错误: Query query = session.createQuery(queryName);}
阅读全文
0 0
- 执行hibernate报错“node to traverse cannot be null”问题的解决
- 执行hibernate报错“node to traverse cannot be null”问题的解决
- node to traverse cannot be null! -- hibernate
- hibernate node to traverse cannot be null!
- hibernate node to traverse cannot be null!
- 2014.03.03 hibernate使用报错 node to traverse cannot be null!
- 异常信息篇-hibernate报错:node to traverse cannot be null
- SSH框架问题——node to traverse cannot be null!报错问题
- Hibernate中报错——node to traverse cannot be null
- 使用hibernate出现node to traverse cannot be null错误
- hibernate错误之node to traverse cannot be null
- hibernate出现node to traverse cannot be null!
- 使用hibernate出现node to traverse cannot be null!
- 使用hibernate出现node to traverse cannot be null!
- java hibernate 中"node to traverse cannot be null"错误解决
- java hibernate 中"node to traverse cannot be null"错误解决
- java hibernate 中"node to traverse cannot be null"错误解决
- node to traverse cannot be null!
- C#面向对象(OOP)入门—第二天—多态和继承(继承)
- C++ 智能指针详解
- submit提交和button提交的区别
- java 接口
- win10下安装Java SDK及配置环境变量(图文教程)
- 执行hibernate报错“node to traverse cannot be null”问题的解决
- 题目101-两点距离
- 如何将同一 VNET 下的虚拟机从经典部署模型迁移到 Azure Resource Manager
- application/json 与 application/x-www-form-urlencoded的简单比较
- Android状态栏微技巧,动态控制状态栏显示和隐藏
- 微信程序开发---thinkPHP无法加载模块:Index
- Java instanceof关键字
- Unity_记分牌_效果实现(随机为例)
- 基于KMP算法的路径下文本查询程序的c++实现2.0版