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. bzoj4429: [Nwerc2015] Elementary Math小学数学

    先把所有可能的答案算出来,每个算式一个点,每个结果一个点,然后如果一个算式能算出一个结果,那么就连一条边 然后跑匈牙利,没有完美匹配就是impossible 每个算式最多有3个结果,所以边数是O(n) ...

  2. javaweb项目打包成war包

    从来没有想过web项目还能打包的,但是有要求,就不得不去实现,在网上找了一下,发现挺简单的. 首先是使用MyEclipse将web项目打包,如下图所示. 右键选中项目,选择export. 然后选择J2 ...

  3. 【BZOJ-1502】月下柠檬树 计算几何 + 自适应Simpson积分

    1502: [NOI2005]月下柠檬树 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 1017  Solved: 562[Submit][Status] ...

  4. eclipse安装插件的方法(简单、ERMaster插件安装)

    ERMaster插件:https://sourceforge.net/projects/ermaster/ 链接:http://pan.baidu.com/s/1o7UWLMa 密码:wkax 可以编 ...

  5. bos启动56898服务器配置界面报错

    //文件路径 /easweb/runtime/server/deploy/portal.ear/portal.war/WEB-INF/config/spring/applicationContext- ...

  6. HDU 1213 How Many Tables(并查集)

    传送门 Description Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Igna ...

  7. [Android]Volley源码分析(二)

    上一篇介绍了Volley的使用,主要接触了Request与RequestQueue这两个类,这篇就来了解一下这两个类的具体实现. Request类图:

  8. TortoiseSVN 过滤文件(包括已提交和未提交)

    一:svn 设置过滤文件方式 1.选中需要过滤的文件夹或者文件---右键---TortoiseSVN---Add to Ignore list(如果不显示说明该目录已经被添加) 2.在当前工作区域 不 ...

  9. Python基本数据类型之dict

    一.创建字典: d = { "name": "morra", #字典是无序的 "age": 99, "gender": ...

  10. JS-制作可伸缩的水平菜单栏

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or ...