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

在一个已经使用mybatis的项目里引入MP,结果不能共存 #1011

Closed
ericbu88 opened this issue Apr 10, 2019 · 5 comments
Closed

Comments

@ericbu88
Copy link

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

mybatis plus 3.1.0

该问题是怎么引起的?(最新版上已修复的会直接close掉)

原有一个项目,已经使用了mybatis,现在需要增加不少功能,涉及到新的表,对于新功能,我考虑使用MP来操作,删除了所有pom中mybatis的依赖,引入MP的依赖,新表CRUD测试成功后,发现老的那些controller都失败了,报如下的错误。但是如果我把mybatisconfig的配置都注释掉,就OK。是否使用mybatisplus后,之前的原生操作方式被影响,然后失效了?

重现步骤

报错信息

{
"timestamp": "2019-04-10 18:12:44",
"status": 500,
"error": "Internal Server Error",
"exception": "org.apache.ibatis.binding.BindingException",
"message": "Invalid bound statement (not found): com.bootcloud.heimdall.dao.OmsOrderDao.getList",
"path": "/oms/order/list"
}

@miemieYaho
Copy link
Member

如 gitee

@GeneralLHW
Copy link

请问该问题怎么解决的呢?我是也出现这个问题,解决不了

@yuxiaobin
Copy link
Contributor

这个问题是,使用MP替换原来的原生mybatis, 那么你原来手写的mapper, xml需要配置到MP里面,不然就会出现“Invalid bound statement (not found):”

@yuxiaobin
Copy link
Contributor

@GeneralLHW
Copy link

嗯,解决了,通俗的说就是原来的yml里面的配置:
mybatis:
mapperLocations: classpath*:mybatis//.xml
configLocation: classpath:sqlmapConfig-admin-mybatis.xml
这个是mybatis的,现在要将配置替换成mybatis-plus的:
mybatis-plus:
mapper-locations: classpath
:mybatis/
/*.xml
config-location: classpath:sqlmapConfig-admin-mybatis.xml
说白了就是将mybatis换成mybatis-plus,然后其他的mapper,xml什么的该怎么写就怎么写,也不用特殊去配置,没有影响

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

4 participants