Skip to content

Conversation

@iamjxc
Copy link

@iamjxc iamjxc commented Nov 19, 2021

In Hibernate, "IN" query only needs to write " in (:xxx) ". And MyBatis needs to use cumbersome script. We made the following changes to make MyBatis support the syntax of "in (#{xxx})" . For example, "select * from user where dept_id in (#{ids})" .After testing on our project, it has no negative impact on existing expressions.

Expand the collection variable into multiple placeholders
If the SQL contains in (#{xxx}), it is marked as dynamic
@piotrponikowski
Copy link
Contributor

This is something I always wanted to be supported by mybatis. I even created own PR with slightly different approach, but there was no response: #1825

@harawata
Copy link
Member

harawata commented Dec 16, 2021

Yeah, sorry about the lack of response. It's not fun to reject PRs.

This feature, as you can imagine, is very popular and has been requested numerous times.
The team's decision, however, was that there is already <foreach /> which does the same thing and more even though it is verbose.
So, we probably won't support any shortcut syntax in version 3.x, at least.

@iamjxc
Copy link
Author

iamjxc commented Dec 17, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants