nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]

Linux Kernel入门到精通系列讲解(RV-Kernel 篇) 5.6 在kernel 中实现系统复位和系统关机驱动 上一章节`Qemu`篇我们已经实现了我们`SOC`的`power reset`和 `power down` 寄存器,本章节我们就在`Linux driver`中去实现它 阅读详情

在使用hibernate时,出现了异常:users is not mapped:

Exception in thread "main" org.springframework.orm.hibernate3.HibernateQueryException: users is not mapped. [from users]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]
	at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:656)
	at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912)
	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:904)
	at com.lwframework.user.dao.impl.UserDAOImpl.findAll(UserDAOImpl.java:31)
	at test.Test.main(Test.java:18)
Caused by: org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]
	at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:157)
	at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
	at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
	at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265)
	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3049)
	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
	at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
	at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
	at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
	at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:914)
	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:1)
	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
	... 5 more
Caused by:  users is not mapped.
	... 27 more

数据库中有一个USERS表,用Users类进行映射,User.hbm.xml检查了好几遍,确定无错,代码中查询语句如下:

String hql="from users";

运行时,出现以上错误。

明明已经映射了Users了,为什么还说没有映射到users呢?对照着错误检查了好几遍,突发奇想:users没映射到,那Users呢?在学sql语句时就知道了sql语句中对大小写是不敏感的,虽然这是hql语句,但差别也不会大到哪去吧?不过想归想,我想是试了下,结果居然然成功了,不再报错了!

总结:HQL与SQL语法大体相同,但本质含义却不同:

SQL是对数据库中 的表进行操作,操作的内容是表和字段,对大小写不敏感

HQL是对类及其属性进行操作,操作的内容是表所映射的类及表中字段所映射的属性,HQL可以对SQL中的关键字(如from,select等)大小写不敏感,但是对类名及属性名大小写敏感,必须区分大小写。





使用阿里天池平台训练YOLO目标检测模型 YOLO算法是一种单阶段目标检测算法,由Joseph Redmon等人于2015年提出。与传统的两阶段检测算法相比,YOLO将目标检测问题转化为回归问题,直接预测边界框的位置和类别概率,大大提高了检测速度。YOLOv1: 首次提出YOLO的核心思想,将图像分割成网格,每个网格预测边界框和类别概率。YOLOv2: 引入了批量归一化、锚框等改进,提高了检测精度。YOLOv3: 采用多尺度预测,增强了对小目标的检测能力。 阅读详情

相关推荐

逆变器方案(工频全套)工频正弦波逆变器开发板全套设计资

逆变器方案(工频全套)工频正弦波逆变器开发板,24V-72V通用12只TO-247封装MOS管,额定输出功率6500W以下;配有触摸屏操作界面,运行数据一目了然,带市电互补UPS功能,可选择电池优先或市电有限工作,我们的开发板均从实战角度出发,让您的学习更便捷,包含全套设计资料,PCB.原理图.源代码,程序均有中文注释,MCU选用美国微芯公的PIC-8位单片机,民用数字电源首选单片机,抗干扰能力强,运行稳定。...

m0_73494033的博客 900

SSH框架开发异常记录:nested exception is org.hibernate.hql.ast.QuerySyntaxException

org.springframework.orm.hibernate3.HibernateQueryException: AdminUser is not mapped [from AdminUser where username = ? and password = ?]; nested exception is org.hibernate.hql.ast.QuerySyntaxException

Howey的博客 1万+

[比赛]新冠期间饿了么骑士行为预估-数据理解

写在前面 饿了么的比赛的赛题数据理解。 一、骑士行为数据 courier_id 骑士id wave_index 波次index tracking_id 订单id courier_wave_start_lng 波次起始时刻骑士位置 courier_wave_...

Helslie的博客 2951

nested exception is org.hibernate.hql.ast.QuerySyntaxException: mgmt_user_info is not mapped

这个错误是由Hibernate在执行HQL(Hibernate Query Language)查询时抛出的。代码经过查看原来是因为不需要映射,直接表名查询的sql,修改查询的方式。项目中报出的问题,记录下,加深记忆。是一个别名或者关键字,请确保它已经在查询语句中正确定义。是一个函数或者条件查询,确保它的用法是正确的。确保任何的属性名或者关联的名字没有拼写错误。部分,确保它符合HQL的语法规则。查看你的实体映射文件或者注解,确保。字段或者属性在实体中是存在的。这部分不被识别的语法。检查HQL查询语句中的。

qq_39496661的博客 477

在x86机器上运行jailhouse

jailhouse jaihouse提供了一个demo ,https://github.com/siemens/jailhouse-images可以用于编译一整套可用的demo。 适用于多个平台。编译过程主要参考https://blog.csdn.net/weixin_39541632/article/details/110422345 此demo可以生成多个平台所用的操作系统image。 ...

闲人的专栏 3007

sentaurus学习笔记(HFET_pGate_GaN仿真)(五)

`(sdedr:define-constant-profile`和`(sdedr:define-constant-profile-region`命令用于定义并应用一个恒定的活性硼掺杂浓度剖面`"ndop_GaN_gate_const"`到氮化镓栅极层上,其值为`NpGaN_gate`。- `"Oxide"`指定了这一层的材料名称(在这里代表氧化层),而`"nucleation"`是这一层在仿真中的标识名称。- `"GaN"`指定了这一层的材料名称,而`"GaN_gate"`是这一层在仿真中的标识名称。

qq_52640792的博客 944

is not mapped.nested exception is org.hibernate.hql.ast.QuerySyntaxException: user_kissfly

Hibernate报这个错误原因一般有两个: 1.没有配置实体关系映射,mapping 2.使用HQL语句查询是用的是对象名而不是表名,注意大小写

Kiss_Fly的专栏 629

IAR9.30以上版本安装、注册、新建工程和配置过程详细介绍

IAR 一般是指一款嵌入式软件的集成开发环境,类似于 MDK-Keil 这款软件。IAR 对于不同的内核处理器,是对应不同的 IAR 软件的,IAR 到目前为止支持大部分的MCU,比如8051系列、ARM架构系列、MSP430系列、AVR系列等等这些常用的芯片架构。对于 ARM 架构的芯片,有对应的 IAR Embedded Workbench for ARM 软件平台,因为我主要是使用 ARM 架构芯片,下面安装、注册和使用都是基于这个版本进行介绍的。

luobeihai的博客 6万+

Hibernate常见错误

Hibernate常见错误 1.错误:object references an unsaved transient instance - save the transient instance before flushing: com.xxxx.bean.java.Sysblog; nested exception is org.hibernate.TransientObjectExcep

scalad 3874

主流 AI 插件 之一的 Copilot 介绍

Copilot 是微软推出的一款人工智能助手,旨在通过自然语言交互帮助您提升工作效率和创造力,覆盖多平台,提供智能问答、内容生成、代码辅助等功能。其核心定位为“日常 AI 伴侣”,旨在通过自然语言交互提升工作与生活效率。

u014695938的博客 6979

ican项目四汽车零件智能测量

ican项目四汽车零件智能测量

weixin_72050316的博客 563

nested exception is org.hibernate.hql.ast.QuerySyntaxException: User_test is not mapped [from User_t...

上面的异常的抛出主要有几个方面:1、最容易想到的,就是你的from是实体类而不是表名,这个应该大家都知道,注意大小写 转载于:https://www.cnblogs.com/zy20160117/p/8544563.html...

weixin_30680385的博客 552

uniapp - HBuilder提示adb: failed to install X Failure [INSTALL_ARSE_FAILED_NOT_APK:X(安装HBuilder调试基座失败)

安装HBuilderX调试基座失败,uniapp APP运行到手机adb: failed to install,Uniapp提示adb,uniapp ios 真机调试报错 uniapp安卓调试,Uniapp安装不了基座,手动安装基座,正在安装手机端HBuilder调试基座,点击运行到手机报错信息:基座无法正常安装,Uniapp-安装HBuilder调试基座失败解决方案,解决 HBuilderX 安卓基座安装失败的问题,显示adb报错,UniApp苹果真机运行调试(自定义基座,版本更新后/没有基座打开失败)如

🏆 前端领域优质创作者 8073

user is not mapped [from user where userName=? and password=?]; nested exception is org.hibernate.hq

SSH关于通过User登录user is not mapped [from user where userName=? and password=?]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: user is not mapped [from user where userName=? and password...

lucas的博客 1387

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

nested exception is org.hibernate.hql.ast.QuerySyntaxException: Product is not mapped [from Product]

是因为配置文件spring.xml没配置好。 就是上面的元素中的少配置了一个Product。加上就可以了。

【小喵】的博客 1079

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

HTTP Status 500 - Request processing failed; nested exception is org.hibernate

HTTP Status 500 - Request processing failed; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: Tab_Bill_Allocate is not mapped [select a.id,a.billNo,a.billDate,u.username,s.name

Endeavour96的博客 7653

Hibernate异常: org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]

Hibernate异常:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]1、出现该错误的情况分析1,配置文件没有加载到hibernate的实体列表里面2,映射文件的字段与数据库字段不一致,或者名称不一致导致hql 是 有专门的语法的,不完全同于sql。切记HQL是大小写敏感的,这点不同于SQL。 …

Langdon1996的博客 972

org.hibernate.hql.ast.QuerySyntaxException: is not mapped解决办法

is not mapped这个异常的抛出主要有几个方面: 1、首先要检查的就是不是表名,这个应该大家都知道,hql语句对大小写很严格,因此请注意大小写;你的hql语句中的from是实体类而 2、你的hibernate配置文件中没有加入相应的映射文件; 3、如果上面两方面检查了都没问题,但是还有错,那就是hql语句有错了,好好检查一下,仔细点,不行就重新写一遍,放到数据

云想衣裳花想容 3万+

org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped 错误

出现这种错误有两种原因:一是你的hql语句 FROM 后跟的是表名而不是实体类名。比如From t_student(表名)这种写法就是错误的,From Student(类名)为正确的写法。二是hibernate 的映射文件没有加载进来,建议这些东西最好复制粘贴,要不然很容易出错。(我就是在这里绊倒了)提供大家一个检测hibernate的映射文件是否加载成功的方法:首先把自动建表的值改为‘updat...

qq_37393900的博客 4444

org.hibernate.hql.internal.ast.QuerySyntaxException: USER is not mapped 报错解决

错误日志: org.hibernate.hql.internal.ast.QuerySyntaxException: USER is not mapped [FROM USER] at org.hibernate.hql.internal.ast.QuerySyntaxException.generateQueryException(QuerySyntaxException.java:79)

sheng_xinjun的博客 9426

SSH中获取数据的时候报错:org.hibernate.hql.internal.ast.QuerySyntaxException: user is not mapped [from user]

SSH中获取数据的时候报错:user is not mapped [from user]报错信息如下:严重: Exception occurred during processing request: org.hibernate.hql.internal.ast.QuerySyntaxException: user is not mapped [from user]java.lang.Illega...

c_lanxiaofang的博客 2849

org.hibernate.hql.internal.ast.QuerySyntaxException错误原因

在开发一个密码重置的功能过程中,因为调用方法失误,报了一个这样的错误: org.hibernate.hql.internal.ast.QuerySyntaxException: USERS is not mapped [sql语句],后面跟一大堆乱七八糟的东西,其实语句已经提示很明显,就是因为Hibernate。 我们都知道Hibernate执行查询的语句hql是面向对象的查询,而非面向数据库...

weixin_39309402的博客 9326

JDBC exception on Hibernate data access问题

JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [72000]; error code [1407]; could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException

lobinsonCJX的博客 9058

nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service

1、Spring_hibernate_整合出现的bug: nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service 这个bug足足困惑了,我两天的时间(业余时间),真费劲心思研究,刚好赶上断网期间,最后不惜流量上网查资料最后还好解决了。 bug翻译是:无法创建...

linjing1003的博客 3883

spring boot 使用hibernate连接表报错QuerySyntaxException: xx is not mapped [FROM xx

错误 新建一个实体类和一张表,使用注解,已经设置好,但是查询时报错 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: MonitorColumnOrganWarningEO is not mapped [FROM MonitorColumnOrganW

闫玉林的博客 1018

hibernate报错

今天在用SSH2做一个项目的模块更新操作的时候,出现: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned ...

有问题请发邮箱dengyifanlittle@163.com进行讨论 1251

SSH Exception 2017.3.23-4org.springframework.orm.hibernate5.HibernateJdbcException

Exception: org.springframework.orm.hibernate5.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [28000]; error code [1045]; Unable to acquire JDBC

TatsuyaLMinami的博客 1885
上一篇: nested exception is java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
下一篇: HibernateTemplate与Session的区别
fcytxdy
博客等级 码龄15年 20粉丝 50原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值