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. ThinkPHP 3.2 Token表单令牌

    /home/conf/config.php 中配置 'TOKEN_ON'=>true, 'TOKEN_NAME'=>'__hash__', 'TOKEN_TYPE'=>'md5', ...

  2. Linux基础3(用户/组管理,rpm,yum,源码安装软件)

    用户管理 与用户相关的配置文件 /etc/passwd /etc/shadow /etc/skel /etc/defalut/useradd /etc/login.defs useradd userm ...

  3. 77.Android之代码混淆

    转载:http://www.jianshu.com/p/7436a1a32891 简介 作为Android开发者,如果你不想开源你的应用,那么在应用发布前,就需要对代码进行混淆处理,从而让我们代码即使 ...

  4. 基于Token的身份验证——JWT

    初次了解JWT,很基础,高手勿喷. 基于Token的身份验证用来替代传统的cookie+session身份验证方法中的session. JWT是啥? JWT就是一个字符串,经过加密处理与校验处理的字符 ...

  5. Birthday-24

    2013 LEXUS花样滑冰 和母亲在一起,生日快乐!

  6. waf2控件名

    1,查询表格(queryGrid),编辑表格(editGrid) wafGrid 2,快速F7 wafPromptQuick 3,表格F7 wafPromptGrid 4,自定义F7 wafPromp ...

  7. PHP预定义接口

    目录 引言 IteratorAggregate(聚合式aggregate迭代器Iterator) Countable ArrayAccess Iterator 总结 引言 在PHP中有好几个预定义的接 ...

  8. SQLite遇到的关于x64、x86问题

    初次使用SQLite遇到了莫名其妙的问题: 未能加载文件或程序集“System.Data.SQLite, Version=1.0.92.0, Culture=neutral, PublicKeyTok ...

  9. Google Guava vs Apache Commons for Argument Validation

    It is an established good practice to validate method arguments at the beginning of the method body. ...

  10. python3,交互模式,无法使用ctrl和方向键,需要和ctrl一块用

    转自csdn博客 http://blog.csdn.net/pumaadamsjack/article/details/52447989 https://pypi.python.org/pypi/re ...