org.hibernate.QueryException: could not resolve property

HibernateSQLXML 

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的更多相关文章

  1. nested exception is org.hibernate.QueryException: could not resolve property

    SSH框架出现了下面的错误: nested exception is org.hibernate.QueryException: could not resolve property 检查了hbm.x ...

  2. org.hibernate.QueryException: could not resolve property: address of:

    Hibernate: select count(*) as y0_ from test.course this_ org.hibernate.QueryException: could not res ...

  3. 常见Hibernate报错处理:出现“org.hibernate.QueryException: could not resolve property”和 is not mapped和could not locate named parameter错误的解决

    正确写法: @Override @SuppressWarnings("unchecked") public List<Device> queryOSDevice(Str ...

  4. Hibernate-org.hibernate.QueryException: could not resolve property: code of:

    查询的时候有个属性跟表里的字段不符合,没有完全匹配上.

  5. org.hibernate.QueryException: Unable to resolve path [SecWilldosetdate.name],xxxxxxxx...异常处理

    今天在写hql语句的时候出现了这个错误,然后一直运行到执行hql这儿就出错了.页面报500. 原hql如下: String hql = "from SecWilldosetdate wher ...

  6. hibernate出现QueryException: could not resolve property 查询异常

    可能是你的属性名写错了,  因为hibernate是面向对象和属性的.

  7. could not resolve property: leader_id of: pojo.Project

    https://www.cnblogs.com/zhaocundang/p/9211270.html hibernate 双向1对多 出现问题 外键解析错误! log4j:WARN No append ...

  8. many to one could not resolve property

    今天在做一个功能的时候 遇到了.一个Could not resolve property 的问题. 配置文件如下: <many-to-one name="user"  cla ...

  9. could not resolve property问题(ssh框架)

    could not resolve property不能解析属性问题, 刚开始把hql语句中的"from User user where user.user_name = '"+u ...

随机推荐

  1. iOS推送通知

    推送通知 此通知非彼通知. NSNotification是抽象的,看不见的,但是可以监听,属于观察者模式的一种设计模式. 推送通知是可见的,能用肉眼看见的,是真正的和用户打交道的通知. 推送通知分为两 ...

  2. Cell右滑的动作状态

    //允许cell可以进行编辑 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)index ...

  3. GCD详解

    什么是GCD? Grand Central Dispatch或者GCD,是一套低层API,提供了一种新的方法来进行并发程序编写.从基本功能上讲,GCD有点像 NSOperationQueue,他们都允 ...

  4. 设置CentOS6.5时钟同步

    一.测试ntp服务 # rpm -q ntp ntp-4.2.4p8-2.el6.x86_64 // 这表示已安装了,如果没有安装,这是空白. 二./etc/ntp.conf 红色部分是修改的. 配置 ...

  5. BZOJ4548 小奇的糖果

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...

  6. $(document).click() 在苹果手机上不能正常运行

    前几天,一位同事在微信上测试一个JQuery的写的购物车功能,出现了一个很奇怪的现象,在android系统上可以正常绑定,但是在iOS上确不能用,经过排除分析,发现其使用了jquery的$(docum ...

  7. array数组加过滤

    var array = new Array(); array.push(0); array.push(1); array.push(2); var arr = array.filter(functio ...

  8. shell命令rm删除非空文件夹

    rm -rf dirName CentOS的自带的资源管理器叫nautilus,在命令行里输入nautilus可以启动它.

  9. Spring 通过maven pom文件配置初始化

    spring对bean的生命周期管理的比较精细,并不是单纯的new()实例化. 1,找到class配置信息并将其实例化 2,受用依赖注入,按照配置信息,配置bean的所有属性; 在一个开始使用前可以用 ...

  10. SQL ALTER TABLE 语句在项目中的使用

    1.在实际的项目开发过程中,之前已经创建好的实体类可能需要增加/删除字段,亦或是更改已有字段的属性,比如主键的增长策略从自增型改为UUID型,那么就会涉及到 SQL 中 alter table 语句的 ...