美文网首页MyBatis+SpringMVC+SpringBoot
Mybatis ReflectionException: The

Mybatis ReflectionException: The

作者: LssTechnology | 来源:发表于2021-01-13 21:21 被阅读0次
背景,一次在使用Mybatis时,出现了org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'distinct' in 'class tk.mybatis.mapper.entity.Example$Criteria'
1、代码如下
@GetMapping("select")
    public void select(Long id) {
        Example example = new Example(Account.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("id", id);
        List<Account> accountList = accountMapper.selectByExample(criteria);
        log.info("accountList:{}", accountList);
    }
2、修改如下
@GetMapping("select")
    public void select(Long id) {
        Example example = new Example(Account.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("id", id);
        List<Account> accountList = accountMapper.selectByExample(example);
        log.info("accountList:{}", accountList);
    }
image.png
希望对你有所帮助

相关文章

网友评论

    本文标题:Mybatis ReflectionException: The

    本文链接:https://www.haomeiwen.com/subject/ojtejktx.html