org.hibernate.QueryException: could not resolve property
org.hibernate.QueryException: could not resolve property
org.hibernate.QueryException: could not resolve property: name of: com.dhsj.stu.entity.Admin
本错误是在action中做查询的时候出错的代码如下:
Restrictions.eq("name", admin.getUsername())
将"name"更替为"username"就可以了,问题解决,原因是我在做映射时把数据库中admin表的name字段在Admin.hbm.xml中映射为"username",然后我在查询的时候仍然用"name"去查询,所以就会报如上异常。
引发org。hibernate。queryexception这样的异常的错误点
经过多次试验等到如下总结:
1. 实体类的类名和表的映射名
2. 字段的映射名和字段
3. 使用DetachedCriteria和Criteria查询时用到Restrictions的属性名
4. HQL和SQL混合使用 等
org.hibernate.QueryException: could not resolve property的更多相关文章
- nested exception is org.hibernate.QueryException: could not resolve property
SSH框架出现了下面的错误: nested exception is org.hibernate.QueryException: could not resolve property 检查了hbm.x ...
- org.hibernate.QueryException: could not resolve property: address of:
Hibernate: select count(*) as y0_ from test.course this_ org.hibernate.QueryException: could not res ...
- 常见Hibernate报错处理:出现“org.hibernate.QueryException: could not resolve property”和 is not mapped和could not locate named parameter错误的解决
正确写法: @Override @SuppressWarnings("unchecked") public List<Device> queryOSDevice(Str ...
- Hibernate-org.hibernate.QueryException: could not resolve property: code of:
查询的时候有个属性跟表里的字段不符合,没有完全匹配上.
- org.hibernate.QueryException: Unable to resolve path [SecWilldosetdate.name],xxxxxxxx...异常处理
今天在写hql语句的时候出现了这个错误,然后一直运行到执行hql这儿就出错了.页面报500. 原hql如下: String hql = "from SecWilldosetdate wher ...
- hibernate出现QueryException: could not resolve property 查询异常
可能是你的属性名写错了, 因为hibernate是面向对象和属性的.
- could not resolve property: leader_id of: pojo.Project
https://www.cnblogs.com/zhaocundang/p/9211270.html hibernate 双向1对多 出现问题 外键解析错误! log4j:WARN No append ...
- many to one could not resolve property
今天在做一个功能的时候 遇到了.一个Could not resolve property 的问题. 配置文件如下: <many-to-one name="user" cla ...
- could not resolve property问题(ssh框架)
could not resolve property不能解析属性问题, 刚开始把hql语句中的"from User user where user.user_name = '"+u ...
随机推荐
- 用git管理源代码
自从做iOS开发的一年多以来,之前一直都是用svn进行代码管理.因为工作需要,我也开始用git管理源代码.关于git的基本使用,在此做一个详细的介绍,希望能对初次接触git的人有所帮助! 本篇博客针对 ...
- 算法求和sum问题
问题:SUM(n) = 1 + 2 + 3 + ... + n写个算法 回答: #include<stdio.h>int main(){ int n,sum; while(sc ...
- BZOJ 1105: [POI2007]石头花园SKA
1105: [POI2007]石头花园SKA Time Limit: 20 Sec Memory Limit: 162 MBSubmit: 628 Solved: 182[Submit][Stat ...
- js-FCC算法-Pairwise
找到你的另一半 都说优秀的程序员擅长面向对象编程,但却经常找不到另一半,这是为什么呢?因为你总是把自己局限成为一个程序员,没有打开自己的思维. 这是一个社群的时代啊,在这里你应该找到与你有相同价值观但 ...
- Java中Unicode的编码和实现
Unicode的编码和实现 大概来说,Unicode编码系统可分为编码方式和实现方式两个层次. 编码方式 字符是抽象的最小文本单位.它没有固定的形状(可能是一个字形),而且没有值.“A”是一个字符,“ ...
- mysql导入sql文件,乱码,一个例子
服务器centos,其他数据库都是utf8都正常能用 网页正常显示 这次导入一个utf8格式数据库文件 结果网页上乱码 在导出的sql文件中,注释部分有些语句也是被mysql考虑的.导出的sql文件, ...
- Bzoj3510首都
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- Java包的命名规范
indi : 个体项目,指个人发起,但非自己独自完成的项目,可公开或私有项目,版权主要属于发起者. 包名为indi.发起者名.项目名.模块名*.*.* pers : 个人项目,指个人发起,独自完成,可 ...
- poj 2528 线段树+离散化
题意:在墙上贴一堆海报(只看横坐标,可以抽象成一线段),新海报可以覆盖旧海报.求最后能看到多少张海报 sol:线段树成段更新.铺第i张海报的时候更新sg[i].x~sg[i].y这一段为i. 然而坐标 ...
- struts2 Advanced Learning
catalog . 引言 . struts2的类型转换 . struts2的输入校验 . struts2的拦截器机制 . 使用struts2的Ajax支持 . struts2 OGNL表达式 . st ...