zoukankan      html  css  js  c++  java
  • springboot2 中Druid和ibatis(baomidou) 遇到org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.iflytek.pandaai.service.multi.mapper.TanancyMapper

    调用mapper中任何方法都会出现类似的错误

    org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.iflytek.pandaai.service.multi.mapper.TanancyMapper.insert
    
    	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227)
    	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49)
    	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
    	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
    	at com.sun.proxy.$Proxy34.insert(Unknown Source)
    	at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.save(ServiceImpl.java:99)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
    

      

    检查 是否是有申明 SqlSessionFactory的bean,例如:

    @Bean(name = "DruidsqlSessionFactory")
        @Primary
        public SqlSessionFactory getSessionFactory(DruidDataSource dataSource) throws Exception {
            SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
            factoryBean.setDataSource(dataSource);
            return factoryBean.getObject();
        }

    而该类和另外的SqlSessionFactory冲突,

    解决办法:

    1、在注解中申明要用的sqlSessionFactory bean名称

    @MapperScan(basePackages = {"com.iflytek.pandaai.service.**.mapper"}, sqlSessionFactoryRef = "sqlSessionFactory")

  • 相关阅读:
    洛谷 P1508 Likecloud-吃、吃、吃
    Codevs 1158 尼克的任务
    2017.10.6 国庆清北 D6T2 同余方程组
    2017.10.6 国庆清北 D6T1 排序
    2017.10.3 国庆清北 D3T3 解迷游戏
    2017.10.3 国庆清北 D3T2 公交车
    2017.10.3 国庆清北 D3T1 括号序列
    2017.10.4 国庆清北 D4T1 财富
    2017.10.7 国庆清北 D7T2 第k大区间
    2017.10.7 国庆清北 D7T1 计数
  • 原文地址:https://www.cnblogs.com/jifeng/p/11823239.html
Copyright © 2011-2022 走看看