MyBatis-Spring-Boot icon indicating copy to clipboard operation
MyBatis-Spring-Boot copied to clipboard

Spring Boot集成MyBatis的基础项目

Results 96 MyBatis-Spring-Boot issues
Sort by recently updated
recently updated
newest added

使用selectAggregationByExample报错: ``` org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.UnsupportedOperationException ```

pagehelper 比如我的总页数是2 我传递页数3 为啥返回的是最后一页的数据 而不是一个null呢

将starter升级为1.2.3然后运行此项目,调用insertList中的方法,抛出如下异常 ``` 2018-01-30 20:37:33.416 DEBUG 23173 --- [9090-Acceptor-0] o.apache.tomcat.util.threads.LimitLatch : Counting up[http-nio-9090-Acceptor-0] latch=1 2018-01-30 20:37:33.416 DEBUG 23173 --- [nio-9090-exec-2] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2126f83b:org.apache.tomcat.util.net.NioChannel@4e072fc0:java.nio.channels.SocketChannel[connected local=/127.0.0.1:9090 remote=/127.0.0.1:63943]], Read from buffer: [0] 2018-01-30...

这种报错在直接使用java.sql.Statement比较好处理。 **但在spring boot 使用starter后需要怎么处理呢?** ``` ### Error updating database. Cause: java.sql.SQLException: No operations allowed after statement closed. ### SQL: INSERT INTO car_tt ( id,insertTime,tid) VALUES( ?,?,?) ### Cause: java.sql.SQLException: No...

能用在elasticsearch搜索分页码?

分页时错误,总共只有9条记录,查询第100页时,理论上应该显示null,但是将最后一条数据返回。 page 传入100 size 传入 2 ,理论上应该为空,但是实际上却是返回了最后一条记录。请大佬解惑下 ``` @GetMapping("/getRecord") public Result getRecord( @RequestParam(value="page", required= true) Integer page, @RequestParam(value="size", required= true) Integer size ){ PageHelper.startPage(page, size); List all = programUpgradeRepos.getAll(); PageInfo...

我按你的方法及框架版本搭架环境,运行时总是显示错误: Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): org.dtjys.mapper.UserMapper.getById at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:196) at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:44) at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:59) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) at com.sun.proxy.$Proxy36.getById(Unknown Source) at org.dtjys.service.impl.UserService.show(UserService.java:17) at org.dtjys.Application.main(Application.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)...

No qualifying bean of type 'tk.mybatis.mapper.common.Mapper' available: expected single matching bean but found 3 异常如上。 通用Service 如下: @Service public abstract class AbsBaseService implements BaseService { @Resource protected Mapper mapper; //根据id查询实体...

我觉得这个scanner有缺陷,直接调用spring的扫描,如果spring注解扫描过了之后,tk的scanner就扫描不到了,因为spring有校验。。。这就报错啦 Caused by: java.lang.InstantiationException: tk.mybatis.mapper.provider.base.BaseInsertProvider BaseInsertProvider这个兼容性也不好,应该有个public BaseInsertProvider(Class mapperClass)这样的构造器然后读spring的bean容器,注册MapperHelper

系统使用了mybatis的插件通用mapper https://github.com/abel533/Mapper 做基类,其他mapper继承这个基类以减少对常规curd的编码。 现在的问题是发现所有基类方法如insert, delete, selectAll 等都无法被拦截,而且如果有方法调用了这些基类方法,也无法被拦截。 定义的注解AuditServiceLog ![ask1](https://user-images.githubusercontent.com/11632864/39976122-91fe9bba-5764-11e8-84af-9502cec5b56f.png) LogAspect ![ask2](https://user-images.githubusercontent.com/11632864/39976130-9aff0362-5764-11e8-9d70-5e4899284486.png) 定义在controller上表现正常 ![ask3](https://user-images.githubusercontent.com/11632864/39976135-a05b4190-5764-11e8-9619-d5384da36c4e.png) 访问对应页面会有日志 ![ask4](https://user-images.githubusercontent.com/11632864/39976139-a530fe08-5764-11e8-9049-6a11734093de.png) 定义在没有调用通用mapper方法的service或者handler方法上也ok ![ask5](https://user-images.githubusercontent.com/11632864/39976141-a93a724a-5764-11e8-8ce2-87923cedaa4d.png) ![ask6](https://user-images.githubusercontent.com/11632864/39976145-aab0412c-5764-11e8-8127-0985bde86a46.png) 而使用了通用mapper方法的则一律没有反应 ![ask7](https://user-images.githubusercontent.com/11632864/39976151-b47fb2f0-5764-11e8-9718-d9f2abc9e049.png) ![ask8](https://user-images.githubusercontent.com/11632864/39976152-b852fd9c-5764-11e8-8cdf-74f3b1d2321f.png) 这里UserService里面调用通用mapper的方法,导致整个UserService上面的方法都不能被拦截。 同时不使用注解直接使用execution语法的方式也尝试过。症状类似,通用mapper的方法被忽略 @Pointcut("execution(* com.hry.spring.mvc.aop.log.service..*.*(..))") aop的配置为springboot默认 ![ask9](https://user-images.githubusercontent.com/11632864/39976159-c331bba4-5764-11e8-88e4-b7fccf152689.png) 有同事使用常规spring mvc(非springboot)通过xml配置的方法,似乎没有特别配置通用mapper就可以被拦截。是这两者有什么区别吗?烦请赐教