Commit 2704a58
Avoid double parentheses in IN predicate rendering.
Prevent duplicate parentheses when rendering IN/NOT IN predicates
with expressions that already contain parentheses. Added logic to
check if predicate string starts and ends with parentheses before
wrapping with additional parentheses.
This change improves JPQL query readability by avoiding patterns
like "field IN (('value1', 'value2'))" and ensures proper syntax
for subqueries and already-parenthesized expressions.
Added comprehensive unit tests to verify the fix handles various
scenarios including regular expressions, pre-parenthesized
expressions, and subquery expressions.
Signed-off-by: Choi Wang Gyu <dhkdrb897@gmail.com>
Closes #3961
Original pull request: #39621 parent ae2ff8f commit 2704a58
File tree
2 files changed
+35
-2
lines changed- spring-data-jpa/src
- main/java/org/springframework/data/jpa/repository/query
- test/java/org/springframework/data/jpa/repository/query
2 files changed
+35
-2
lines changedLines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
1422 | 1423 | | |
1423 | 1424 | | |
1424 | 1425 | | |
1425 | | - | |
1426 | | - | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
1427 | 1434 | | |
1428 | 1435 | | |
1429 | 1436 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
139 | 165 | | |
140 | 166 | | |
141 | 167 | | |
| |||
0 commit comments