异常中文翻译如下:
查询数据库时出错。原因:. 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, [email protected](select="com.itheima.ssm.IMemberDao.findById")) }) Orders findById(String id); }
这个异常是我用映射做表查询的时候遇到的,表与表关系是多对多关系,上面英文说的大概就是映射语句不包含某个方法的值,其实这个异常很简单,,出错的原因就是上面倒数第二行代码中select指定的方法少写了一个包名称,导致Mybatis映射不到
IMemberDao接口中我要执行的方法,所以才会报这个错误,很低级的一个错误,但是对于我这个新手来说在这么多代码中找这个异常还是花了不少时间.发出来帮助比我还马虎的网友...
原文地址:https://www.cnblogs.com/zhangxiaozhen/p/9819939.html