mybatis-3 icon indicating copy to clipboard operation
mybatis-3 copied to clipboard

Support the syntax of "in (#{xxx})"

Open iamjxc opened this issue 3 years ago • 3 comments

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.

iamjxc avatar Nov 19 '21 10:11 iamjxc

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: https://github.com/mybatis/mybatis-3/pull/1825

piotrponikowski avatar Dec 16 '21 19:12 piotrponikowski

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.

harawata avatar Dec 16 '21 20:12 harawata

We just want to shorten the gap with hibernate and reduce the cumbersome code of development. We expect this feature to be added in the next major release.

| | jxc | | @.*** | On 12/17/2021 04:32,Iwao @.***> wrote:

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 which does the same thing and more even though it is verbose. So, we probably won't support any simple syntax in version 3.x, at least.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

iamjxc avatar Dec 17 '21 14:12 iamjxc