MyBatis version
3.4.6
Database vendor and version
mysql
Test case or example project
Steps to reproduce
Expected result
Actual result
Comment From: jinjim
I debug into our pageSegementInterceptor,
when we new a BoundSql ,it do not parse additionalParameters。But,if we get BoundSql by MappedStatement.getBoundSql(),we can get right result with additionalParameters.
our sql:
@Select({ ""})
Comment From: harawata
Hello @jinjim ,
We need information to reproduce the issue on our end. Please provide a test case or demo project with minimum set of tables, columns, java objects. You can use dummy names for table, column, etc. if necessary.
Comment From: jinjim
Hello @jinjim ,
We need information to reproduce the issue on our end. Please provide a test case or demo project with minimum set of tables, columns, java objects. You can use dummy names for table, column, etc. if necessary.
https://github.com/jinjim/mybatisTestCase/tree/master
Comment From: harawata
Thank you for the repro, @jinjim ,
It seems that the custom interceptor PageSegmentInterceptor
is causing the error.
The test passes if I removed the interceptor from the configuration, so this does not seem to be a MyBatis issue.
Could you please clarify?
Comment From: jinjim
Thank you for the repro, @jinjim ,
It seems that the custom interceptor
PageSegmentInterceptor
is causing the error. The test passes if I removed the interceptor from the configuration, so this does not seem to be a MyBatis issue. Could you please clarify?
it seems,
PageSegmentInterceptor
#setTotalRecord,when we new a BoundSql,it do not parse additionalParameters
which is key point of #{item} .of course,we can use mappedStatement.getBoundSql(parameterObject)
to get placeholder pamaters.
Comment From: jinjim
What I am a little confused is when we create a BoundSql,Should it include all the parameters necessary for this sql execution
Comment From: harawata
@jinjim ,
In your interceptor, you rewrite private fields using reflection and we don't support such usage. You can do whatever you want in your interceptor, but it is your responsibility if it malfunctioned. :)
If you need help with custom interceptor implementation, try posting a question to the mailing list or stack overflow.
Closing as it is not a bug.