我出现的错误是:org.hibernate.hql.ast.QuerySyntaxException: loginuser is not mapped [from loginuser]

配置文件如下:

<class name="User" table="loginuser">
     <id name="id" column="Id"  type="java.lang.Integer">
         <generator class="native"/>
     </id>
     <property name="username" column="username"  type="java.lang.String"/>
     <property name="password" column="password"  type="java.lang.String"/>
     <property name="sex" column="sex"  type="java.lang.String"/>
</class>

代码如下:

List<User> list=session.createQuery

我出现的错误是:org.hibernate.hql.ast.QuerySyntaxException: loginuser is not mapped [from loginuser]

配置文件如下:

<class name="User" table="loginuser">
     <id name="id" column="Id"  type="java.lang.Integer">
         <generator class="native"/>
     </id>
     <property name="username" column="username"  type="java.lang.String"/>
     <property name="password" column="password"  type="java.lang.String"/>
     <property name="sex" column="sex"  type="java.lang.String"/>
</class>

代码如下:

List<User> list=session.createQuery("from loginuser").list();

而出现这个错误的根本原因是hql语法里面是POJO对象而不是table.所以改成这样就可以了:

List<User> list=session.createQuery("from User").list();

特记于此!以备勿忘!

("from loginuser").list();

而出现这个错误的根本原因是hql语法里面是POJO对象而不是table.所以改成这样就可以了:

List<User> list=session.createQuery("from User").list();

特记于此!以备勿忘!

is not mapped [from错误的更多相关文章

  1. HQL中出现XXX is not mapped的错误

    我的代码如下 @Test public void testCollection(){ String hql = "from Order where orderItems is not emp ...

  2. 常见Hibernate报错处理:出现“org.hibernate.QueryException: could not resolve property”和 is not mapped和could not locate named parameter错误的解决

    正确写法: @Override @SuppressWarnings("unchecked") public List<Device> queryOSDevice(Str ...

  3. R语言 启动报错 *** glibc detected *** /usr/lib64/R/bin/exec/R: free(): invalid next size (fast): 0x000000000263a420 *** 错误 解决方案

    *** glibc detected *** /usr/lib64/R/bin/exec/R: free(): invalid next size (fast): 0x000000000263a420 ...

  4. cocos2d-x 开发中的小问题 在xcode4环境下

    转自:http://hi.baidu.com/baby_66_/item/302353174f19521cd0d66df2 1.如果你在想怎么去搞定程序的开始运行的背景一闪而过的大图 以及icon想换 ...

  5. 航空概论(历年资料,引之百度文库,PS:未调格式,有点乱)

    航空航天尔雅 选择题1. 已经实现了<天方夜谭>中的飞毯设想.—— A——美国2. 地球到月球大约—— C 38 万公里3. 建立了航空史上第一条定期空中路线—— B——德国4. 对于孔明 ...

  6. are both mapped to the url-pattern 错误解决方法

    今天运行tomcat的时候出现报了一大波错误,下面我截取了部分错误信息: 严重:A child container failed during start java.util.concurrent.E ...

  7. 错误: Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for studentDao.insert

    详细错误信息: org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: java. ...

  8. eclipse使用SSH框架出现There is no Action mapped for namespace [/] and action name [] associated with context path错误

    eclipse使用SSH框架出现There is no Action mapped for namespace [/] and action name [] associated with conte ...

  9. is not mapped 错误改正

    我出现的错误是:oorg.hibernate.hql.ast.QuerySyntaxException: DEPT is not mapped [from DEPT] 配置文件如下: <?xml ...

随机推荐

  1. 洛谷 1197 [JSOI2008]星球大战

    [题解] 把询问离线,倒着加点,并查集维护连通性即可. #include<cstdio> #include<cstring> #include<algorithm> ...

  2. 集训第六周 数学概念与方法 J题 数论,质因数分解

    Description Tomorrow is contest day, Are you all ready? We have been training for 45 days, and all g ...

  3. 配置bean

    [bean配置] 在XML文件中通过bean节点来配置bean <!-- 配置bean class: bean的全类名,通过反射的方式在IOC容器中创建bean,所以要求bean中必须有无参的构 ...

  4. two strings

    A1484. two strings(罗干) 时间限制:1.0s   内存限制:256.0MB [问题描述] 给定两个字符串A和B,有五种操作,操作1为在A串开头添加一个字符,操作2为在A串结尾添加一 ...

  5. HTML Imports & polyfill

    组件化浏览器的兼容性问题汇总 框架依赖的 Web 标准技术 优先级高 HTML Imports HTML tempaltes ES6 to ES5 (搭建模块开发环境) polyfill https: ...

  6. CodeForces - 425E Sereja and Sets 题解

    题目大意: 我们有一个集合 S,其中包含了 m 个不完全相同的区间[l1,r1],[l2,r2]…[lm,rm] (1≤li≤ri≤n,li,ri 都为整数). 定义 f(S)=k,表示集合 S 中能 ...

  7. javaSctipt基础

    ===================================== JavaScript 脚本语言===================================== 什么是JavaSc ...

  8. mysql实现oracle序列

    mysql实现oracle序列的方案1.建表,表结构为:drop table if exists sequence; create table sequence ( seq_name VARCHAR( ...

  9. apache.commons.lang.StringUtils 使用心得

    原文:http://blog.csdn.net/ye_sheng/article/details/48101901?ref=myread 在Java中我们用的最多的类应该就是String了.对于Str ...

  10. vuex资料

    vuex最简单.最详细的入门文档 链接:https://segmentfault.com/a/1190000009404727 https://www.jb51.net/article/138239. ...