Users not mapped!!!
来源:互联网 发布:澳洲人工智能专业 编辑:程序博客网 时间:2024/06/04 19:21
今天晚上自己试着用Hibernate去搭建一个Web工程,然后去实现一个简单的登录。
通过Hibernate?做查询操作的时候总是报出这样的错:
users is?not?mapped.
于是乎去检查了下映射,发现没问题呀,反复验证结果还是一样报错。
User.hbm.xml:
<class name="com.lian.bean.User" table="users">
hibernate.cfg.xml:
<mapping resource="com/lian/bean/User.hbm.xml" />
在网上找了很多,但还是不给力,大家都没提些有建设性的解决方案,基本上都是说配置有问题。
不过自己感觉是这个出问题:
String sql = "select u.password from users u where u.username='" +user.getUsername()+ "'";
经过多番纠结和耐心查找资料,发现:
原来 HQL语句中表名应该是ORM映射的类名,所以应该改成:
String sql = "select u.password from User u where u.username='" +user.getUsername()+ "'";
通过Hibernate?做查询操作的时候总是报出这样的错:
users is?not?mapped.
于是乎去检查了下映射,发现没问题呀,反复验证结果还是一样报错。
User.hbm.xml:
<class name="com.lian.bean.User" table="users">
hibernate.cfg.xml:
<mapping resource="com/lian/bean/User.hbm.xml" />
在网上找了很多,但还是不给力,大家都没提些有建设性的解决方案,基本上都是说配置有问题。
不过自己感觉是这个出问题:
String sql = "select u.password from users u where u.username='" +user.getUsername()+ "'";
经过多番纠结和耐心查找资料,发现:
原来 HQL语句中表名应该是ORM映射的类名,所以应该改成:
String sql = "select u.password from User u where u.username='" +user.getUsername()+ "'";
sql 语句查找的是生成的User 类,不是普通的表。 。。。。
其实注解方式也是一样的!!!
- Users not mapped!!!
- Users not mapped!!!
- Hibernate 中出现 users is not mapped 问题
- Hibernate 中出现 users is not mapped 问题
- Hibernate 中出现 users is not mapped 问题
- Hibernate 中出现 QuerySyntaxException: users is not mapped
- Hibernate 中出现 users is not mapped 问题
- org.hibernate.hql.internal.ast.QuerySyntaxException: users is not mapped
- nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]
- table is not mapped
- Hibernate Is Not Mapped
- is not mapped 问题
- (Hibernate) is not mapped
- table not mapped [
- hibernate not mapped
- is not mapped [from
- is not mapped
- table is not mapped
- 使用C6EZRun开发OMAP平台的DSP内核
- Eclipse常用快捷键(备忘)
- 在ICCAVR中通过使用库函数来避免直接看到敏感算法源码
- 并行计算笔记
- ubuntu下安装显卡GeForce GT440驱动
- Users not mapped!!!
- CF 4D Mysterious Present
- 来看看不同语言程序员的自我优越感
- 虚拟机ubuntu和主机xp间共享文件
- fzu 2037 卡内存的坑爹题
- VC6复制粘贴中文内容出现乱码的解决办法
- 读取文件夹下所有文件方法及CFileFind类基本用法
- jquery中实现显示、隐藏、淡入淡出
- win32显示位图