javax.persistence.EntityNotFoundException: Unable to find com.bfxy.bean.producttype.ProductType with id 0 这个异常怎么回事想不通
id 0什么意思啊我有更好的答案
2条回答
select o from ProductType o where o.parent is null
第一个o是什么,字段名么,对于这个我很费解
第一个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