Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service.save() Invalid bound statement (not found) #550

Closed
songlongkuan opened this issue Oct 11, 2018 · 23 comments
Closed

service.save() Invalid bound statement (not found) #550

songlongkuan opened this issue Oct 11, 2018 · 23 comments

Comments

@songlongkuan
Copy link

songlongkuan commented Oct 11, 2018

当前使用版本(必须填写清楚,否则不予处理)

mybatis-plus-boot-starter
3.0.1

该问题是怎么引起的?(请使用最新版(具体版本查看CHANGELOG.md),如还有该问题再提 issue!)

调用service的save方法引起的

重现步骤

每次必现

报错信息

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxxx.db.mapper.TopicModelMapper.insert
at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:227)
at org.apache.ibatis.binding.MapperMethod.(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.$Proxy108.insert(Unknown Source)
at com.yscall.kulaidian.db.service.impl.TopicServiceImpl.addTopic(TopicServiceImpl.java:37)
at com.yscall.kulaidian.db.service.impl.TopicServiceImpl$$FastClassBySpringCGLIB$$4b778966.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:685)
at

@songlongkuan
Copy link
Author

大兄弟 着急啊 能不能帮忙看看

@miemieYaho
Copy link
Member

mapper没扫描到

@songlongkuan
Copy link
Author

不太可能 我在没用plus之前 一直好好的 现在没用plus的mapper都正常 继承了BaseMapper的mapper 就不正常 会报这个错

@songlongkuan
Copy link
Author

算了 这东西我还是无福消受 我还是用我的Mybatis吧

@songlongkuan
Copy link
Author

关issue倒是挺快....

@songlongkuan
Copy link
Author

文档看了好几遍了 不行

@songlongkuan
Copy link
Author

非plus的mapper 和 plus的mapper是在同一个包下 mapper肯定是能扫描到的 非plus 的mapper是可以正常使用的 但是plus的mapper 插入就报错

@qmdx
Copy link
Member

qmdx commented Oct 11, 2018

好好看看我发的那些连接,问题就是配置这块,没有自动注入。

@songlongkuan
Copy link
Author

项目是SpringBoot 2.0
这个配置按文档上加了
mybatis-plus:
mapper-locations: classpath*:/mapper/**/.xml
然后不行 我又尝试更改为我之前用Mybatis的配置 改成如下了
mybatis-plus:
mapper-locations: classpath:mapper/
.xml
也还是不行

再然后 MapperScan注解也配置了 我可以肯定 绝对配置的是mapper的包名
而且同一个包下的非plus mapper正常、

不是maven多模块项目
表名叫topic 命名空间应该不会又问题

@songlongkuan
Copy link
Author

而且官方的Mybatis maven被我删了 只留下

com.baomidou
mybatis-plus-boot-starter
3.0.1

@qmdx
Copy link
Member

qmdx commented Oct 11, 2018


# 参考 配置
mybatis-plus:
  configuration:
    cache-enabled: false
    map-underscore-to-camel-case: true
  mapper-locations: classpath:mapper/**/*Mapper.xml
  typeAliasesPackage: com.baomidou.ant.*.entity
  global-config:
    db-config:
      logic-delete-value: 1
      logic-not-delete-value: 0
      table-underline: true
      column-like: true

xml 在 jar 中 classpath*:mapper/**/*Mapper.xml

@songlongkuan
Copy link
Author

还是不行 = =

@DawsonYung
Copy link

现在解决了吗??我也碰到了同样的问题,怎么弄都不行

@songlongkuan
Copy link
Author

没有 我已经抛弃它了

@DawsonYung
Copy link

好吧 我在研究下

@DawsonYung
Copy link

@pencilso 兄弟 我解决了 手残了 创建的xml时文件格式有问题

@songlongkuan
Copy link
Author

我的xml格式肯定没毛病的 我没用plus正常 用plus就不正常

@songlongkuan
Copy link
Author

只用Mybatis 没问题

@DawsonYung
Copy link

哈哈哈 这样的问题 看起来 真头疼 一个个比对 肯定那块有问题

@reidchan
Copy link

reidchan commented Dec 4, 2018

@pencilso 你是不是用了多数据源,我也是这种情况,就plus相关的Mapper不行,估计是多数据源的问题。

@RickFallen
Copy link

@pencilso @DawsonYung 大胸弟 你应该是@MapperScan注解用错了
com.xxxx.db.*.mapper 是不对的
应该用com.xxxx.db.**.mapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants