hibernate中could not resolve property和is not mapped的问题
来源:互联网 发布:百度网盘会员破解mac 编辑:程序博客网 时间:2024/06/06 10:03
最近在学ssh,遇到了一些问题,这里我记录两个关于hibernate的问题。is not mapped表示映射出了错,在我写的删除语句:"from Role_right rr where rr.role_id = "+roleId,其中的role_right是数据库的表名,role_id是该表的一个字段名。我的相应配置文件代码是这样的:
<class name="cn.edu.scu.urims.common.entities.RoleRight" table="role_right" catalog="urims">
<id name="roleRightId" type="java.lang.Integer">
<column name="role_right_id" />
<generator class="identity" />
</id>
<many-to-one name="role" class="cn.edu.scu.urims.common.entities.Role" fetch="select">
<column name="role_id" not-null="false" />
</many-to-one>
</class>
当执行删除的时候,就报错说 is not mapped。以前以为from后面直接跟表名,因为老师这么讲的,只是表名的第一个字母要大写,到现在出现错了才明白原因。hibernate查询的是映射的类名,而不是自己的表名,所以会出现映射出错。从这里看,红色字体才是hibernate的类名,因此查询的时候应该写RoleRight,而不是表名role_right。
这样子改了又出现了一个问题:could not resolve property。从字面上理解就是无法辨别的属性,其实和上面那个问题类似,都是在hibernate文件映射的时候出的问题,蓝色字为RoleRight的属性,而不是去查询表中的role_id字段,所以正确的查询语句应该是"fromRoleRight rr where rr.role = "+roleId,
- hibernate中could not resolve property和is not mapped的问题
- hibernate could not resolve property
- could not resolve property hibernate
- nested exception is org.hibernate.QueryException:could not resolve property:
- hibernate属性映射出现could not resolve property问题
- org.hibernate.QueryException: could not resolve property
- org.hibernate.QueryException: could not resolve property:
- org.hibernate.QueryException: could not resolve property
- org.hibernate.QueryException: could not resolve property:
- org.hibernate.QueryException: could not resolve property
- 关于hibernate的is not mapped问题
- 异常org.hibernate.QueryException: could not resolve property的原因
- 异常org.hibernate.QueryException: could not resolve property的原因
- Hibernate Is Not Mapped
- (Hibernate) is not mapped
- Hibernate - is not mapped
- Hibernate 中出现 users is not mapped 问题
- Hibernate 中出现 XXXX is not mapped 问题
- java其他工具类
- css中自己对定位的理解。
- logcat监听System.out.println()的输出
- Android NDK开发入门实例
- HDU 4405 Aeroplane chess 概率dp
- hibernate中could not resolve property和is not mapped的问题
- mllib之梯度下降公式推导
- 九度OJ-1172-哈夫曼树
- 论述rfid与物联网关系
- C++中char类型详解
- iOS笔记1
- 快速排序算法
- 淘宝装修:1920全屏海报(源代码免费下载)
- ARM9自学笔记_汇编指令1