Hibernate Class Is Not Mapped
来源:互联网 发布:java开源项目管理系统 编辑:程序博客网 时间:2024/05/20 23:56
Hibernate Class Is Not Mapped ?
1.http://blog.csdn.net/mycxsky/archive/2008/12/02/3430131.aspx
好久没玩Hibernate了,都忘记了,今天碰到一个关于没有映射的错误,找了半天才发现原来是HQL的错误。
org.springframework.orm.hibernate3.HibernateQueryException: USERINFO is not mapped.
看到.hbm.xml文件中的
<hibernate-mapping package="form">
<class table="USERINFO" name="form.UserInfoForm">
<id type="java.lang.String" name="UserName">
</id>
配置一直以为所要的对象是table后的USERINFO表名;所以一直报错找不到相关的映射,终于明白原来HQL语句的表名语句不是table而是name属性
From UserInfoForm uif where ...
这里的核心思想是查看那name的属性,而不是直接使用类的名字或者是数据库中的表明。
2.http://blog.csdn.net/zxq1406spys/archive/2008/09/04/2881258.aspx
我用Hibernate实现一个教师的登陆过程,当我在JSP的登陆页面输入姓名和密码,点登陆后,显示登陆失败页,在服务器里显示如下的错误信息:
org.hibernate.hql.ast.QuerySyntaxException: teachers is not mapped. [from teache
rs tea where tea.name=:teaName and tea.password=:teaPassword]
HQL错了
因为Hibernate是对类查询的
在hql="from teachers tea where tea.name=:teaName and tea.password=:teaPassword";中,
teachers是数据库中的表,而teachers对应的类是Teachers.java,现在只需要将teachers改为Teachers就可以了,即
hql="from Teachers tea where tea.name=:teaName and tea.password=:teaPassword";
这个和上面的方法是大致相同的。
- Hibernate Class Is Not Mapped
- Hibernate Class Is Not Mapped ?
- Hibernate Class Is Not Mapped
- Hibernate Class Is Not Mapped【转载】
- Hibernate Is Not Mapped
- (Hibernate) is not mapped
- Hibernate - is not mapped
- hibernate XXX is not mapped
- Hibernate is not mapped [from
- hibernate 出现***is not mapped
- Hibernate: user is not mapped
- 关于hibernate的is not mapped问题
- Hibernate XX is not Mapped问题笔记
- hibernate:XXX is not mapped问题
- hibernate 出现 is not mapped 问题
- class is not mapped 和 Unknown entity问题解决
- org.hibernate.hql.ast.QuerySyntaxException is not mapped
- org.hibernate.hql.ast.QuerySyntaxException: myaddressbook is not mapped
- 一个模板线程池
- QuickSort 快速排序
- ORA-01034错误
- 黑莓开发者的第一个BlackBerry应用开发--搭建环境
- JSP导出EXCEL
- Hibernate Class Is Not Mapped
- c#后台调用前台与js方法互调
- 南开100题java 1-10
- Dolby(杜比)
- ApplicationResources乱码解决方法
- C++转义字符
- 黑莓开发者的第一个BlackBerry应用开发--Hello World的开发
- Dolby Digital(Dolby Surround Digital,杜比数码环绕声)
- javascript基础全等号运算符