Comments (9)
问题解决了,是因为系统启动的时候PageHelperAutoConfiguration会自动注册,只需要在启动的时候排除掉即可,写法:@SpringBootApplication(exclude = PageHelperAutoConfiguration.class)。
from mybatis-pagehelper.
有几个 sqlSession ?
from mybatis-pagehelper.
用了两个@configuration注册了两个DataSource,对应有两个SqlSessionFactory,分别扫描自己的mapper,一个为主数据加了@primary,另一个没有加。只有调用@primary的mapper前的pagehelper有效,可以分页,无@primary的pagehelper设置无效。
from mybatis-pagehelper.
分页插件配置两个了吗?
from mybatis-pagehelper.
原来一个数据源的代码是用PageHelper.startPage(query.getPage(), query.getPageSize())进行分页的,
数据源和mapper调整为两套后,出现这个问题。
spring-boot,在application.yml中有如下配置
pagehelper:
helperDialect: SqlServer2014Dialect
reasonable: true
supportMethodsArguments: true
params: count=countSql
是否支持两个分页插件,如果可以两个分页插件如何配置?沿用原来的startPage这种调用模式是否可以?
from mybatis-pagehelper.
一个sqlsession就得对应一个配置。。静态方法可以用,不会乱。
from mybatis-pagehelper.
终于搞定,不过发现主数据源@primary中不能用setPlugins来设置PageInterceptor,会生成错误的sql,导致错误,只能在application.yml中配置,才能有效。
而另一个数据源必须在SqlSessionFactory中setPlugins才能有效,在application.yml无法配置。
有点弄不明白,应该都可以用setPlugins配置,为什么@primary就不可以?
from mybatis-pagehelper.
我也发现,好像配置多数据源之后,分页有问题。
from mybatis-pagehelper.
@jandyu 你是怎么解决的?我也是在SqlSessionFactory设置了Plugins,但是在执行SQL时提示配置了多个分页插件的异常
from mybatis-pagehelper.
Related Issues (20)
- 这个参数根本没用pagehelper.auto-dialect=false,代码里一直都是true,无法控制 HOT 4
- 多数据库方言就有问题,假如我第一次使用了mysql,然后使用sqlserver查询就还是用的limit分页;代码逻辑有问题具体看详情 HOT 9
- Springboot3版本supportMethodsArguments参数失效 HOT 2
- NoClassDefFoundError: net/sf/jsqlparser/statement/select/ParenthesedSelect HOT 1
- 开启asyncCount 时,打印的sql语句不全 HOT 2
- JSqlParser4.8 HOT 1
- 如何兼容MybatisPlus 3.5.5 和 PageHelper 2.1.0 ? HOT 7
- make PageInfo implement Collection, and then can use it as a List directly HOT 1
- 开启异步count支持后,不兼容Mybatis-Plus的多租户插件 HOT 4
- springboot3.2.2引入pageHelper5.3.2执行分页方法报类型转换异常。分页不生效 HOT 1
- 开发者福利,尽快尝试领取!StarkNet针对TOP 5K进行空投!
- pagehelper在docker中卡在了启动欢迎处 HOT 1
- sqlserver 使用 PageHelper.startPage 分页报错 HOT 3
- 数据查询返回后进行转化,hasNextPage属性值永远是false HOT 3
- 升级到6.1.0后jsqlparser4.7又出问题了 HOT 2
- 版本由4.1.6 升级到5.3.2后,PageDynamicSqlSource被删除了有什么方案代替 HOT 1
- PageHelper6.1.0搭配jsqlparser4.5又出问题了
- springboot 3 整合 pagehelper 报错 Caused by: java.lang.NoClassDefFoundError: net/sf/jsqlparser/statement/select/SelectBody HOT 2
- sqlparser-timeout超时时间好像不是10秒 HOT 2
- SqlServer 跨服务器查询语句,会提示不支持该SQL转换为分页查询 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybatis-pagehelper.