HQL中出现XXX is not mapped的错误
我的代码如下
@Test
public void testCollection(){
String hql = "from Order where orderItems is not empty"; Query query = session.createQuery(hql); List<Order> orders = query.list(); for(Order o:orders){ System.out.println(o.getCustomer().getName()); System.out.println(o.getAmount()); } }
由于没有在HQL语句中使用别名,而包里存在一个OrderItem的类,使其编译无法通过,所以将代码改写如下即可运行。
@Test
public void testCollection(){
String hql = "from Order o where o.orderItems is not empty"; Query query = session.createQuery(hql); List<Order> orders = query.list(); for(Order o:orders){ System.out.println(o.getCustomer().getName()); System.out.println(o.getAmount()); } }
HQL中出现XXX is not mapped的错误的更多相关文章
- org.hibernate.hql.ast.QuerySyntaxException: XXX is not mapped
因为 String sql2 = "select s from Student s where s.clazz.name=:name"; 此处的 Student 应该为类名.hql ...
- 关于Hibernate XXX is not mapped 错误
我的实体类是这么配置的 @Entity(name="EntityName") //必须,name为可选,对应数据库中一的个表 就会出现 XXX is not mapped. ...
- hibernate:XXX is not mapped
hibernate:XXX is not mapped 检查项目中是否将hbm.xml引入
- SSH执行hql报错:Caused by: org.hibernate.hql.ast.QuerySyntaxException: user is not mapped [from user where username = ?]
报错信息: ERROR Dispatcher:38 - Exception occurred during processing request: user is not mapped [from u ...
- Hibernate 中出现 users is not mapped 问题
Hibernate 中出现 users is not mapped 问题: 解答:HQL语句中表名应该是ORM映射的类名,所以应该改成: (如果是用注解生成实体类,那就是注解的那个类)String ...
- XXX is not mapped
这个问题绊了我两次跟头,作为一个3年多开发经验的人,甚是尴尬 java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntax ...
- org.hibernate.hql.ast.QuerySyntaxException: Student is not mapped [from Student as stu where stu.sclass=?]
java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: t_aty_disease is not ...
- org.hibernate.hql.ast.QuerySyntaxException: tb_voteoption is not mapped [from tb_voteoption where voteID=?]
转自:https://www.cnblogs.com/albert1017/archive/2012/08/25/2656873.html org.hibernate.hql.ast.QuerySyn ...
- Hql 中 dao 层 以及daoimpl 层的代码,让mvc 模式更直观简洁
1.BaseDao接口: //使用BaseDao<T> 泛型 ,在service中注入的时候,只需要将T换为对应的bean即可 public interface BaseDao<T& ...
随机推荐
- 关于又拍云免费cdn全网加速服务的长期评测(各种踩坑)
原文转载自「刘悦的技术博客」 ( https://v3u.cn/a_id_128 ) 妇孺皆知,前端优化中最重要的优化手段之一就是cdn加速,所谓cdn加速就是采用更多的缓存服务器(CDN边缘节点), ...
- 跳转语句break、continue、return
1.break 语句 概念: break语句在循环中的作用是终止当前循环,在switch语句中的作用是终止switch. 示例: 输出结果: 2.continue 语句 概念: continue语句 ...
- 万答#1,MySQL中如何查询某个表上的IS(意向共享)锁
欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 问题 问题原文是这样的: 假如在MySQL事务里,给某个表的一行加了 共享锁,理 ...
- http、https和Cookie
http和https http,https 都是网络传输协议 是用于网络相关传输,http走的是明文传输,https走的密文传输(内部采用对称加密以及非对称加密).对应的https安全性要高于http ...
- 一个注解搞定SpringBoot接口定制属性加解密
前言 上个月公司另一个团队做的新项目上线后大体上运行稳定,但包括研发负责人在内的两个人在项目上线后立马就跳槽了,然后又交接给了我这个「垃圾回收人员」. 本周甲方另一个厂家的监控平台扫描到我们这个项目某 ...
- LuoguP5201 [USACO19JAN]Shortcut(最短路树)
字典序?建树时从小枚举,用\(Dijkstra\)的血泪建好树,\(size\)大小决定贡献 #include <iostream> #include <cstdio> #in ...
- 透过inode来理解硬链接和软链接
什么是inode? 每个文件都对应一个唯一的inode,inode用来存储文件的元信息,包括: 对应的文件 文件字节数 文件数据块的位置 文件的inode号码 文件的硬链接数 文件的读写权限 文件的时 ...
- HTTP 的 Content-Type 及其媒体类型(MIME)
Content-Type Content-Type 代表 HTTP 携带的文件类型,决定文件接收方或发送方将以什么形式.什么编码读取这个文件.下图,load.gif 的媒体类型就是 image/gif ...
- Dart 异步编程(一):初步认识
由于 Dart 是单线程编程语言,对于进行网络请求和I/O操作,线程将发生阻塞,严重影响依赖于此任务的下一步操作. 通常,在一个阻塞任务之后还有许许多多的任务等待被执行.下一步任务需要上一步任务的结果 ...
- [WPF]使用DispatcherUnhandledException捕捉未经处理的异常
使用DispatcherUnhandledException捕捉未经处理的异常 using System.Windows; namespace Test02 { /// <summary> ...