zoukankan      html  css  js  c++  java
  • 关于映射语句集合不包含com.itheima.ssm.IMemberDao.findById的值的异常

    异常中文翻译如下:


    查询数据库时出错。原因:. 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接口中我要执行的方法,所以才会报这个错误,很低级的一个错误,但是对于我这个新手来说在这么多代码中找这个异常还是花了不少时间.发出来帮助比我还马虎的网友...
    
    
  • 相关阅读:
    HTTP 筛选器 DLL C:WindowsMicrosoft.NetFrameworkv4.0.30319aspnet_filter.dll 加载失败。数据是错误。
    win7(iis7)无法加载运行CSS文件的解决方法
    MVC异步消息推送机制
    查看目录下所有文件的行数
    解决 mac全屏时不能隐藏Dock工具栏 killall Dock
    jetty中传java参数(spring-io中的配置项)
    nginx代理前端项目
    【转】mackbook wifi卡死未响应的问题
    WeekMap WeakSet的用途
    每日新知2019-08-23
  • 原文地址:https://www.cnblogs.com/zhangxiaozhen/p/9819939.html
Copyright © 2011-2022 走看看