用Hibernate实现一个用户的登陆过程,当我在JSP的登陆页面输入姓名和密码,点登陆后,显示登陆失败页,在服务器里显示如下的错误信息: 
    org.hibernate.hql.ast.QuerySyntaxException: user is not mapped. [from User where UserNO=? and Password=?]

因为Hibernate是对类查询的 
在hql="select * from user u where u.username='"+username+"' and u.password='"+password+"'中, 
user是数据库中的表,而user对应的类是User.java,现在只需要将from user改为from User,同时不用在出现select *即可,即 
hql="from User u where u.username='"+username+"' and u.password='"+password+".

user is not mapped的更多相关文章

  1. Hibernate 中出现表名(XXX) is not mapped 问题

    今天晚上自己试着用Hibernate去搭建一个Web工程,然后去实现一个简单的登录.通过Hibernate?做查询操作的时候总是报出这样的错:users is?not?mapped. 于是乎去检查了下 ...

  2. should be mapped with insert="false" update="false

    SSH项目出现了 should be mapped with insert="false" update="false 错误,仔细检查后发现,是两个不同的属性映射了表中的 ...

  3. struts2中错误There is no Action mapped for namespace [/] and action name [] associated with context path

    1 There is no Action mapped for namespace [/] and action name [] associated with context path [/Stru ...

  4. struts2报错:There is no Action mapped for namespace [/] and action name [userAction!add]

    使用struts2.3进行动态方法调用时出现: There is no Action mapped for namespace [/user] and action name [user!add] a ...

  5. SSH整合报错:org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped[......]

    非常诡异的报错,信息如下:org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped [select count(* ...

  6. struct2的structs.xml文件配置There is no Action mapped for action name 问题

    很久没写过博客,今天重新开始写,新技术太多,只有通过博客才可以不断积累,本人水平有限,如有错误,欢迎指正,谢谢 今天在MAVEN上配置web project的struct2,发现自己忽略了很多问题,再 ...

  7. hibernate:Named query not known: findXXXX or XXXX is not mapped

    .hbm.xml文件所放的位置怎么看怎么都在spring配置的扫描路径中,就是会出现标题所示错误,查看log日志,的确也没发现XXXX被mapped的记录~ 参考解决方案: 在eclipse导出jar ...

  8. 关于Hibernate XXX is not mapped 错误

    我的实体类是这么配置的 @Entity(name="EntityName")  //必须,name为可选,对应数据库中一的个表 就会出现 XXX is not mapped.   ...

  9. 使用英文版eclipse保存代码,出现some characters cannot be mapped using "Cp1251" character encoding.

    some characters cannot be mapped using "Cp1251" character encoding. 解决办法:方案一: eclipse-> ...

  10. Hibernate 中出现 users is not mapped 问题 (转)

    今天晚上自己试着用Hibernate去搭建一个Web工程,然后去实现一个简单的登录.         通过Hibernate 做查询操作的时候总是报出这样的错:                    ...

随机推荐

  1. Android_Dialog

    layout.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xml ...

  2. [转]使用ADO.NET访问Oracle存储过程

    本文转自:http://www.cnblogs.com/datasky/archive/2007/11/07/952141.html 本文讨论了如何使用 ADO.NET 访问 Oracle 存储过程( ...

  3. 哇!今天找到一个非常好用的自动补全插件-necomplete.vim

    看别人说的什么xpcomplete,snipte,拿来都不会用,这个necomplete.vim还挺好用的,不用去按C-X,C-O进行补全,把关键字自动的列出来,调用的是用户自定义补全,^u^n^p的 ...

  4. 关于datalist

    http://www.cnblogs.com/shipfi/archive/2009/10/19/1585705.html

  5. 20160611-20160714springmvc入门进阶

    springmvc第二阶段 高级知识 复习: springmvc框架: DispatcherServlet前端控制器:接收request,进行response HandlerMapping处理器映射器 ...

  6. Brackets 配置

    插件 Brackets Icons  左侧导航的文件图标 FuncDocr  注释工具 QuickDocsJS  js帮助文档 Beautify  格式化代码 Brackets Git  git支持 ...

  7. (十)Hibernate 查询方式

     所有项目导入对应的hibernate的jar包.mysql的jar包和添加每次都需要用到的HibernateUtil.java 第一节:Hibernate 查询方式简介 1,导航对象图查询方式: 2 ...

  8. ajax查询数据返回结果不变

    在使用流水号的时候,Google浏览器没有问题,但是IE有缓存,如果ajax请求的参数没有变化,那么就会返回缓存里的数据 解决方法:ajax请求的时候传值的参数设置一个时间戳就OK了(没什么特别意义, ...

  9. 简单模拟Hibernate的主要功能实现

    在学习期间接触到Hibernate框架,这是一款非常优秀的O/R映射框架,大大简化了在开发web项目过程中对数据库的操作.这里就简单模拟其底层的实现. /*******代码部分,及其主要注解***** ...

  10. make menuconfig出错需要安装文件

    $ make menuconfig *** Unable to find the ncurses libraries or the *** required header files. *** 'ma ...