码迷,mamicode.com
首页 > 数据库 > 详细

关于映射语句集合不包含com.itheima.ssm.IMemberDao.findById的值的异常

时间:2018-10-20 00:13:45      阅读:1701      评论:0      收藏:0      [点我收藏+]

标签:新手   结果   ibatis   member   col   mapped   statement   ESS   rop   

技术分享图片

异常中文翻译如下:


查询数据库时出错。原因:. lang。映射语句集合不包含com.itheima.ssm.IMemberDao.findById的值

这个错误可能存在于com/itheima/ssm/dao/ITravellerDao中。java(猜测)

这个错误可能涉及com.itheima.ssm.dao.ITravellerDao.findByOrdersId

在处理结果时发生错误

### SQL: select * from Traveller where id in(从order_traveller中选择travellerId where orderId=?)

# # #原因:. lang。IllegalArgumentException:映射语句集合不包含com.itheima.ssm.IMemberDao的值。带有根本原因的findById]

. lang。映射语句集合不包含com.itheima.ssm.IMemberDao.findById的值

org.apache.ibatis.session.Configuration StrictMap.get美元(Configuration.java:888)

org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:721)

org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:714)



代码如下:

@Select("select * from orders where id=#{id}")
@Results({
@Result(id=true,column = "id",property = "id"),
@Result(property = "orderNum",column = "orderNum"),
@Result(property = "orderTime",column = "orderTime"),
@Result(column = "orderStatus",property = "orderStatus"),
@Result(column = "peopleCount",property = "peopleCount"),
@Result(column = "payType",property = "payType"),
@Result(column = "orderDesc",property = "orderDesc"),
@Result(column = "productId",property ="product",javaType = Product.class,
one = @One(select = "com.itheima.ssm.dao.IProductDao.findById")),
@Result(column = "id",property = "travellers",javaType = java.util.List.class,
many = @Many(select = "com.itheima.ssm.dao.ITravellerDao.findByOrdersId")),
@Result(column ="memberId",property = "member",javaType = Member.class,
one=@One(select="com.itheima.ssm.IMemberDao.findById"))


})
Orders findById(String id);

}

 

这个异常是我用映射做表查询的时候遇到的,表与表关系是多对多关系,上面英文说的大概就是映射语句不包含某个方法的值,其实这个异常很简单,,出错的原因就是上面倒数第二行代码中select指定的方法少写了一个包名称,导致Mybatis映射不到

IMemberDao接口中我要执行的方法,所以才会报这个错误,很低级的一个错误,但是对于我这个新手来说在这么多代码中找这个异常还是花了不少时间.发出来帮助比我还马虎的网友...

关于映射语句集合不包含com.itheima.ssm.IMemberDao.findById的值的异常

标签:新手   结果   ibatis   member   col   mapped   statement   ESS   rop   

原文地址:https://www.cnblogs.com/zhangxiaozhen/p/9819939.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!