Mapped Statements collection already contains value for ********

集成Mybatis莫名其妙报了这错,下面是我的测试代码:

    @Select("select * from user where username = #{username}")
    @Results({
            @Result(property = "username", column = "user_name"),
            @Result(property = "password", column = "password")
    })
    User getUser(String username);

    @Select("select * from user where id = #{id}")
    @ResultMap("BaseResultMap")
    User getUser(int id);




    
        
        
        
    

......

乍一看没啥问题啊,报的错误看起来像是id重复之类的,网上大部分的解释也是id重复巴拉巴拉,其实,这里跟id没毛关系,是因为我在上面定义了两个重名,返回值还一样的方法

User getUser(....)

把其中一个改下名字就okay了。


不会炒股的程序员不是好程序员,加Q一起做韭菜吧:1249943558

你可能感兴趣的:(Mapped Statements collection already contains value for ********)