-
Notifications
You must be signed in to change notification settings - Fork 212
question : how to reuse where clauses ? #150
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
Comments
This is a really interesting question! I had not considered the use case of reusing where clauses, but it makes perfect sense. I don't have a great answer for you now, but I will look into it and see if I can make something work. |
I've committed a potential solution in my branch here: https://github.com/jeffgbutler/mybatis-dynamic-sql/tree/reusable-where There's a bit of noise in this for the implementation, but you can just pay attention to the test classes. The Java test class is here: https://github.com/jeffgbutler/mybatis-dynamic-sql/blob/reusable-where/src/test/java/examples/simple/ReusableWhereTest.java The Kotlin test class is here: https://github.com/jeffgbutler/mybatis-dynamic-sql/blob/reusable-where/src/test/kotlin/examples/kotlin/mybatis3/canonical/ReusableWhereTest.kt Let me know what you think. |
This looks exactly what I need. |
Resolved via #152 |
Hello mate, thanks for this awesome lib!
I got a question trying to reuse some complex where clause between
mapper.selectMany
andmapepr.countByExample
. With the example classes generated against runtimeMyBatis3
, I could reuse a built up example instance betweenselect
andcount
, how can I do this with runtimeMyBatis3DynamicSQL
?The purpose to reuse the where clauses is that in some situations we need to return a total count for the records matching the criteria, then do another select to return a paginated result set by setting additional offset and limit.
Looking forward to your reply, thanks!
The text was updated successfully, but these errors were encountered: