-
Notifications
You must be signed in to change notification settings - Fork 211
Fixed Limit and Offset Support bugs when using Subqueries in where cl… #142
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
Conversation
Thanks for reporting this issue! This PR breaks a lot of tests, so we can't merge it unless it is changed. Also, you would need to add a test for this issue. |
Okay, I'll do that. |
|
||
public FetchFirstPagingModelRenderer(RenderingStrategy renderingStrategy, | ||
PagingModel pagingModel) { | ||
PagingModel pagingModel,AtomicInteger sequence) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pleas add a space before the new parameter
|
||
public LimitAndOffsetPagingModelRenderer(RenderingStrategy renderingStrategy, | ||
Long limit, PagingModel pagingModel) { | ||
Long limit, PagingModel pagingModel,AtomicInteger sequence) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space before the new parameter
return this; | ||
} | ||
|
||
private Optional<AtomicInteger> sequence() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this method - sequence is not optional
@@ -38,16 +41,17 @@ private PagingModelRenderer(Builder builder) { | |||
|
|||
private Optional<FragmentAndParameters> limitAndOffsetRender(Long limit) { | |||
return new LimitAndOffsetPagingModelRenderer(renderingStrategy, limit, | |||
pagingModel).render(); | |||
pagingModel,sequence).render(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space before the new parameter
} | ||
|
||
private Optional<FragmentAndParameters> fetchFirstRender() { | ||
return new FetchFirstPagingModelRenderer(renderingStrategy, pagingModel).render(); | ||
return new FetchFirstPagingModelRenderer(renderingStrategy, pagingModel,sequence).render(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space before the new parameter
|
||
private PagingModelRenderer(Builder builder) { | ||
renderingStrategy = Objects.requireNonNull(builder.renderingStrategy); | ||
pagingModel = Objects.requireNonNull(builder.pagingModel); | ||
sequence = builder.sequence().orElseGet(() -> new AtomicInteger(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the same pattern as the other parameters: sequence = Objects.requireNonNull(builder.sequence)
Thanks for your contribution! |
I should thank you for your project. |
With the change for mybatis#142 it no longer makes sense to have specialized parameter names for limit, offset, etc.
Hi, I haved tried to fix a bug of Limit and Offset Support when using Subqueries in where clauses.
My code:
Final statement as follows:
Exception as follows: