org.hibernate.hql.internal.ast.QuerySyntaxException: users is not mapped
来源:互联网 发布:dota2看视频软件 编辑:程序博客网 时间:2024/06/05 22:52
struct2和hibernate框架的学习果然是一波三折啊 错误不断 而且还找不到答案
User实体类
package com.scx.entity;public class Users {private int uid;private String username;private String password;public Users(int uid, String username, String password) {this.uid = uid;this.username = username;this.password = password;}public Users() {}public int getUid() {return uid;}public void setUid(int uid) {this.uid = uid;}public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}}
Users.hbm.xml
<hibernate-mapping> <class name="com.scx.entity.Users" table="USERS" catalog="studentmanagent"> <id name="uid" type="java.lang.Integer"> <column name="UID" /> <generator class="native" /> </id> <property name="username" type="string"> <column name="USERNAME" length="30"></column> </property> <property name="password" type="string"> <column name="PASSWORD" length="30"></column> </property> </class></hibernate-mapping>
我的hql语句
hql = "from users where username = ? and password = ?";使用junit测试的时候 总是报org.hibernate.hql.internal.ast.QuerySyntaxException: users is not mapped
字面意思好像就是users没有映射 可是我明明配置的有啊 卡了很久
于是就开始修改hql语句了 大小写各种互换 一次偶然机会 让我找到了
修改为
hql = "from Users where username = ? and password = ?";仅仅修改了users为Users 就正确了 或许在hql中 对应的不是表名 应该是hbm.xml的文件名。。仅仅猜测。
1 0
- org.hibernate.hql.internal.ast.QuerySyntaxException: users is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: Exam is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: table is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: appUser is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: FwbzItem is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: ### is not mapped
- nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]
- exception is org.hibernate.hql.internal.ast.QuerySyntaxException: Driver is not mapped...的坑
- Hibernate查询报错:org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped
- Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: table is not Mapped问题解决
- 出现org.hibernate.hql.internal.ast.QuerySyntaxException: goodsinfo is not mapped [from goodsinfo错误
- org.hibernate.hql.internal.ast.QuerySyntaxException: Admin is not mapped [from Admin where username=
- org.hibernate.hql.internal.ast.QuerySyntaxException: XXXX is not mapped [from XXXX]
- 异常收集-org.hibernate.hql.internal.ast.QuerySyntaxException: activityinfo is not mapped
- Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: table is not Mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped [from XXX]
- org.hibernate.hql.internal.ast.QuerySyntaxException: USER is not mapped 报错解决
- Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Student is not mapped
- ubuntu一些基本操作命令
- php正则拉取网站导航及连接
- 外部排序
- dos下文本复制与粘贴的三种方式
- 161130
- org.hibernate.hql.internal.ast.QuerySyntaxException: users is not mapped
- Missing artifact net.sf.json-lib:json-lib:jar:2.4
- PostgreSQL basebackup备份
- static class 静态类(Java)
- Java in PowerShell on Windows 10
- etting pink textures in build
- 十一月英语学习
- HDU 5573 Binary Tree 2015ACM/ICPC亚洲区上海站 (构造)
- LeetCode 45. Jump Game II