zoukankan      html  css  js  c++  java
  • mybatis-plus Invalid bound statement (not found) 问题

    自己搭一个项目,spring boot+mybatis-plus,引用mybatis-plus  执行发现自己写的sql可以执行,执行basemapper里的方法就会出错,

    mybatis-plus Invalid bound statement (not found) 

    检查文件(application.yml、mapper.xml等)配置,编译加载是否正确

    发现都没什么问题,包加载也替换了几个版本,还是不行,

    后面发现需要将mybatis的sqlSessionFactory替换成mybatis-plusd的MybatisSqlSessionFactoryBean

    因为是自己写的sqlSessionFactory加载一直也没注意到这个问题,使用默认配置应该也没有这个问题,记录下

      @Bean("sqlSessionFactory")
    @Primary
    public SqlSessionFactory sqlSessionFactory(@Autowired @Qualifier("dataSource") DataSource dataSource) throws Exception {

    MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSource);
    sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));

    // Interceptor interceptor = new PageInterceptor();
    // Properties properties = new Properties();
    // properties.setProperty("helperDialect", "sqlserver");
    // properties.setProperty("offsetAsPageNum", "true");
    // properties.setProperty("rowBoundsWithCount", "true");
    // properties.setProperty("reasonable", "false");
    // interceptor.setProperties(properties);
    // sqlSessionFactoryBean.setPlugins(new Interceptor[] {interceptor});


    return sqlSessionFactoryBean.getObject();

    }
  • 相关阅读:
    godaddy 问题
    2014.10.5 再次学习LINUX
    自测 基础 js 脚本。
    error: cast from ‘char*’ to ‘int’ loses precision
    python 使用 Pyscript 调试 报错
    VS2012出现加载失败时的解决办法 win7同样适用
    Program received signal SIGILL, Illegal instruction
    visual assist x 注释配置
    python 学习网站
    python 典型文件结构
  • 原文地址:https://www.cnblogs.com/zhouyb/p/10469973.html
Copyright © 2011-2022 走看看