select o from ProductType o where o.parent is null;所搜顶级目录
2015-08-07 00:01
330 查看
select o from ProductType o where o.parent is null;所搜顶级目录
2012-07-31 16:57w103437w2008 | 浏览522 次 悬赏:25
javax.persistence.EntityNotFoundException: Unable to find com.bfxy.bean.producttype.ProductType with id 0 这个异常怎么回事想不通
id 0什么意思啊
我有更好的答案
分享到:
2条回答
2012-07-31 17:06laistars | 五级 最快回答select o from ProductType o where o.parent is null
第一个o是什么,字段名么,对于这个我很费解
追问:
o ProductType 是别名JPA里面的 这没问题 问题是我加上o.parent is null 就报错
追答:
从提示错误上看,应该不是语句的问题,你自己想想吧!我没遇到过这样的问题
追问:
Unable to find com.bfxy.bean.producttype.ProductType with id 0 怎么会出现这样的错呢, 我查的是 id=0拿来的啊
追答:
id=0...?你的id字段是自增字段不,怎么会等于0
追问:
(Query query =em.createQuery("select o from ProductType o where o.parent is null ");执行没问题) for(Object ob:query.getResultList()){ } 执行报错
评论 | 0 0
2012-09-26 21:46itaobao100 | 五级
o其实是一个对象,该方法是按照对象查询的
你传入的类的类型和数据库中你查找的表不匹配
相关文章推荐
- Java学习笔记(十一)Collections framework之collection接口,iterator接口
- AnyChart 7.6.0版本发布【附下载】
- VIEWGOOD(远古)政府流媒体视频解决方案
- Hadoop 相关指令
- IOS开发中使用TFHpple解析html
- IOS开发中rss解析数据解析
- IOS开发中ICON的正确设置图片分辨率
- js浮点数值计算
- makefile学习(一)
- 冰点促销,“夏”不为利!暑期充电,选天嵌!
- mybatis
- 通达OA-医疗卫生行业系统解决方案
- android 分辨率适配
- python 中文
- Hibernate入门入门三
- Oracle修改字段类型方法
- Mybatis 示例之 SelectKey
- Node.js开发框架Express4.x
- 星期五可以推荐个游戏
- JQuery 给元素添加样式,去除样式