Skip to content

Commit db8489e

Browse files
merge latest main and resolve conflict
1 parent 5634537 commit db8489e

File tree

5 files changed

+78
-65
lines changed

5 files changed

+78
-65
lines changed

src/integrationTest/java/com/mongodb/hibernate/embeddable/StructAggregateEmbeddableIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ void testReadNestedValuesMissingFields() {
471471
"""
472472
{
473473
_id: 1,
474-
nested1: {},
474+
nested1: {a: 0},
475475
nested2: {
476476
a: 3,
477477
nested: {

src/integrationTest/java/com/mongodb/hibernate/query/mutation/DeletionIntegrationTests.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ void testDeletionWithNonZeroMutationCount() {
7676
"title": "Crime and Punishment",
7777
"outOfStock": false,
7878
"publishYear": 1866,
79-
"isbn13": {"$numberLong": "0"},
80-
"discount": {"$numberDouble": "0"},
81-
"price": {"$numberDecimal": "0.0"}
79+
"isbn13": null,
80+
"discount": null,
81+
"price": null
8282
}
8383
"""),
8484
BsonDocument.parse(
@@ -88,9 +88,9 @@ void testDeletionWithNonZeroMutationCount() {
8888
"title": "Anna Karenina",
8989
"outOfStock": false,
9090
"publishYear": 1877,
91-
"isbn13": {"$numberLong": "0"},
92-
"discount": {"$numberDouble": "0"},
93-
"price": {"$numberDecimal": "0.0"}
91+
"isbn13": null,
92+
"discount": null,
93+
"price": null
9494
}
9595
"""),
9696
BsonDocument.parse(
@@ -100,9 +100,9 @@ void testDeletionWithNonZeroMutationCount() {
100100
"title": "The Brothers Karamazov",
101101
"outOfStock": false,
102102
"publishYear": 1880,
103-
"isbn13": {"$numberLong": "0"},
104-
"discount": {"$numberDouble": "0"},
105-
"price": {"$numberDecimal": "0.0"}
103+
"isbn13": null,
104+
"discount": null,
105+
"price": null
106106
}
107107
""")),
108108
Set.of(Book.COLLECTION_NAME));
@@ -138,9 +138,9 @@ void testDeletionWithZeroMutationCount() {
138138
"title": "War and Peace",
139139
"outOfStock": true,
140140
"publishYear": 1869,
141-
"isbn13": {"$numberLong": "0"},
142-
"discount": {"$numberDouble": "0"},
143-
"price": {"$numberDecimal": "0.0"}
141+
"isbn13": null,
142+
"discount": null,
143+
"price": null
144144
}
145145
"""),
146146
BsonDocument.parse(
@@ -150,9 +150,9 @@ void testDeletionWithZeroMutationCount() {
150150
"title": "Crime and Punishment",
151151
"outOfStock": false,
152152
"publishYear": 1866,
153-
"isbn13": {"$numberLong": "0"},
154-
"discount": {"$numberDouble": "0"},
155-
"price": {"$numberDecimal": "0.0"}
153+
"isbn13": null,
154+
"discount": null,
155+
"price": null
156156
}
157157
"""),
158158
BsonDocument.parse(
@@ -162,9 +162,9 @@ void testDeletionWithZeroMutationCount() {
162162
"title": "Anna Karenina",
163163
"outOfStock": false,
164164
"publishYear": 1877,
165-
"isbn13": {"$numberLong": "0"},
166-
"discount": {"$numberDouble": "0"},
167-
"price": {"$numberDecimal": "0.0"}
165+
"isbn13": null,
166+
"discount": null,
167+
"price": null
168168
}
169169
"""),
170170
BsonDocument.parse(
@@ -174,9 +174,9 @@ void testDeletionWithZeroMutationCount() {
174174
"title": "The Brothers Karamazov",
175175
"outOfStock": false,
176176
"publishYear": 1880,
177-
"isbn13": {"$numberLong": "0"},
178-
"discount": {"$numberDouble": "0"},
179-
"price": {"$numberDecimal": "0.0"}
177+
"isbn13": null,
178+
"discount": null,
179+
"price": null
180180
}
181181
"""),
182182
BsonDocument.parse(
@@ -186,9 +186,9 @@ void testDeletionWithZeroMutationCount() {
186186
"title": "War and Peace",
187187
"outOfStock": false,
188188
"publishYear": 2025,
189-
"isbn13": {"$numberLong": "0"},
190-
"discount": {"$numberDouble": "0"},
191-
"price": {"$numberDecimal": "0.0"}
189+
"isbn13": null,
190+
"discount": null,
191+
"price": null
192192
}
193193
""")),
194194
Set.of(Book.COLLECTION_NAME));

src/integrationTest/java/com/mongodb/hibernate/query/mutation/UpdatingIntegrationTests.java

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ void testUpdateWithNonZeroMutationCount() {
8282
"title": "War and Peace",
8383
"outOfStock": false,
8484
"publishYear": 1869,
85-
"isbn13": {"$numberLong": "0"},
86-
"discount": {"$numberDouble": "0"},
87-
"price": {"$numberDecimal": "0.0"}
85+
"isbn13": null,
86+
"discount": null,
87+
"price": null
8888
}
8989
"""),
9090
BsonDocument.parse(
@@ -94,9 +94,9 @@ void testUpdateWithNonZeroMutationCount() {
9494
"title": "Crime and Punishment",
9595
"outOfStock": false,
9696
"publishYear": 1866,
97-
"isbn13": {"$numberLong": "0"},
98-
"discount": {"$numberDouble": "0"},
99-
"price": {"$numberDecimal": "0.0"}
97+
"isbn13": null,
98+
"discount": null,
99+
"price": null
100100
}
101101
"""),
102102
BsonDocument.parse(
@@ -106,9 +106,9 @@ void testUpdateWithNonZeroMutationCount() {
106106
"title": "Anna Karenina",
107107
"outOfStock": false,
108108
"publishYear": 1877,
109-
"isbn13": {"$numberLong": "0"},
110-
"discount": {"$numberDouble": "0"},
111-
"price": {"$numberDecimal": "0.0"}
109+
"isbn13": null,
110+
"discount": null,
111+
"price": null
112112
}
113113
"""),
114114
BsonDocument.parse(
@@ -118,9 +118,9 @@ void testUpdateWithNonZeroMutationCount() {
118118
"title": "The Brothers Karamazov",
119119
"outOfStock": false,
120120
"publishYear": 1880,
121-
"isbn13": {"$numberLong": "0"},
122-
"discount": {"$numberDouble": "0"},
123-
"price": {"$numberDecimal": "0.0"}
121+
"isbn13": null,
122+
"discount": null,
123+
"price": null
124124
}
125125
"""),
126126
BsonDocument.parse(
@@ -130,9 +130,9 @@ void testUpdateWithNonZeroMutationCount() {
130130
"title": "War and Peace",
131131
"outOfStock": false,
132132
"publishYear": 2025,
133-
"isbn13": {"$numberLong": "0"},
134-
"discount": {"$numberDouble": "0"},
135-
"price": {"$numberDecimal": "0.0"}
133+
"isbn13": null,
134+
"discount": null,
135+
"price": null
136136
}
137137
""")),
138138
Set.of(Book.COLLECTION_NAME));
@@ -173,9 +173,9 @@ void testUpdateWithZeroMutationCount() {
173173
"title": "War & Peace",
174174
"outOfStock": true,
175175
"publishYear": 1869,
176-
"isbn13": {"$numberLong": "0"},
177-
"discount": {"$numberDouble": "0"},
178-
"price": {"$numberDecimal": "0.0"}
176+
"isbn13": null,
177+
"discount": null,
178+
"price": null
179179
}
180180
"""),
181181
BsonDocument.parse(
@@ -185,9 +185,9 @@ void testUpdateWithZeroMutationCount() {
185185
"title": "Crime and Punishment",
186186
"outOfStock": false,
187187
"publishYear": 1866,
188-
"isbn13": {"$numberLong": "0"},
189-
"discount": {"$numberDouble": "0"},
190-
"price": {"$numberDecimal": "0.0"}
188+
"isbn13": null,
189+
"discount": null,
190+
"price": null
191191
}
192192
"""),
193193
BsonDocument.parse(
@@ -197,9 +197,9 @@ void testUpdateWithZeroMutationCount() {
197197
"title": "Anna Karenina",
198198
"outOfStock": false,
199199
"publishYear": 1877,
200-
"isbn13": {"$numberLong": "0"},
201-
"discount": {"$numberDouble": "0"},
202-
"price": {"$numberDecimal": "0.0"}
200+
"isbn13": null,
201+
"discount": null,
202+
"price": null
203203
}
204204
"""),
205205
BsonDocument.parse(
@@ -209,9 +209,9 @@ void testUpdateWithZeroMutationCount() {
209209
"title": "The Brothers Karamazov",
210210
"outOfStock": false,
211211
"publishYear": 1880,
212-
"isbn13": {"$numberLong": "0"},
213-
"discount": {"$numberDouble": "0"},
214-
"price": {"$numberDecimal": "0.0"}
212+
"isbn13": null,
213+
"discount": null,
214+
"price": null
215215
}
216216
"""),
217217
BsonDocument.parse(
@@ -221,9 +221,9 @@ void testUpdateWithZeroMutationCount() {
221221
"title": "War & Peace",
222222
"outOfStock": false,
223223
"publishYear": 2025,
224-
"isbn13": {"$numberLong": "0"},
225-
"discount": {"$numberDouble": "0"},
226-
"price": {"$numberDecimal": "0.0"}
224+
"isbn13": null,
225+
"discount": null,
226+
"price": null
227227
}
228228
""")),
229229
Set.of(Book.COLLECTION_NAME));

src/integrationTest/java/com/mongodb/hibernate/query/select/SortingSelectQueryIntegrationTests.java

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class SortingSelectQueryIntegrationTests extends AbstractQueryIntegrationTests {
4949
new Book(4, "The Brothers Karamazov", 1880, false),
5050
new Book(5, "War and Peace", 2025, false));
5151

52+
@BeforeEach
53+
void beforeEach() {
54+
getSessionFactoryScope().inTransaction(session -> testingBooks.forEach(session::persist));
55+
getTestCommandListener().clear();
56+
}
57+
5258
private static List<Book> getBooksByIds(int... ids) {
5359
return Arrays.stream(ids)
5460
.mapToObj(id -> testingBooks.stream()
@@ -88,7 +94,8 @@ void testOrderBySingleFieldWithoutTies(String sortDirection) {
8894
}
8995
"""
9096
.formatted(sortDirection.equals("ASC") ? 1 : -1),
91-
sortDirection.equals("ASC") ? getBooksByIds(2, 1, 3, 4, 5) : getBooksByIds(5, 4, 3, 1, 2));
97+
sortDirection.equals("ASC") ? getBooksByIds(2, 1, 3, 4, 5) : getBooksByIds(5, 4, 3, 1, 2),
98+
Set.of(Book.COLLECTION_NAME));
9299
}
93100

94101
@ParameterizedTest
@@ -129,7 +136,8 @@ void testOrderBySingleFieldWithTies(String sortDirection) {
129136
: resultList -> assertThat(resultList)
130137
.satisfiesAnyOf(
131138
list -> assertIterableEq(getBooksByIds(1, 5, 4, 2, 3), list),
132-
list -> assertIterableEq(getBooksByIds(5, 1, 4, 2, 3), list)));
139+
list -> assertIterableEq(getBooksByIds(5, 1, 4, 2, 3), list)),
140+
Set.of(Book.COLLECTION_NAME));
133141
}
134142

135143
@Test
@@ -168,7 +176,8 @@ void testOrderByMultipleFieldsWithoutTies() {
168176
}
169177
]
170178
}""",
171-
getBooksByIds(3, 2, 4, 5));
179+
getBooksByIds(3, 2, 4, 5),
180+
Set.of(Book.COLLECTION_NAME));
172181
}
173182

174183
@Test
@@ -180,7 +189,8 @@ void testOrderByMultipleFieldsWithTies() {
180189
resultList -> assertThat(resultList)
181190
.satisfiesAnyOf(
182191
list -> assertIterableEq(getBooksByIds(3, 2, 4, 1, 5), list),
183-
list -> assertIterableEq(getBooksByIds(3, 2, 4, 5, 1), list)));
192+
list -> assertIterableEq(getBooksByIds(3, 2, 4, 5, 1), list)),
193+
Set.of(Book.COLLECTION_NAME));
184194
}
185195

186196
@Test
@@ -212,7 +222,8 @@ void testSortFieldByAlias() {
212222
new Object[] {"The Brothers Karamazov", 1880},
213223
new Object[] {"Anna Karenina", 1877},
214224
new Object[] {"War and Peace", 1869},
215-
new Object[] {"Crime and Punishment", 1866}));
225+
new Object[] {"Crime and Punishment", 1866}),
226+
Set.of(Book.COLLECTION_NAME));
216227
}
217228

218229
@Test
@@ -243,13 +254,14 @@ void testSortFieldByOrdinalReference() {
243254
new Object[] {"Crime and Punishment", 1866},
244255
new Object[] {"The Brothers Karamazov", 1880},
245256
new Object[] {"War and Peace", 2025},
246-
new Object[] {"War and Peace", 1869}));
257+
new Object[] {"War and Peace", 1869}),
258+
Set.of(Book.COLLECTION_NAME));
247259
}
248260

249261
@Nested
250262
@DomainModel(annotatedClasses = Book.class)
251263
@ServiceRegistry(settings = @Setting(name = DEFAULT_NULL_ORDERING, value = "first"))
252-
class DefaultNullPrecedenceTests extends AbstractSelectionQueryIntegrationTests {
264+
class DefaultNullPrecedenceTests extends AbstractQueryIntegrationTests {
253265
@Test
254266
void testDefaultNullPrecedenceFeatureNotSupported() {
255267
assertSelectQueryFailure(
@@ -329,7 +341,8 @@ void testOrderBySimpleTuple() {
329341
]
330342
}
331343
""",
332-
getBooksByIds(2, 1, 3, 4, 5));
344+
getBooksByIds(2, 1, 3, 4, 5),
345+
Set.of(Book.COLLECTION_NAME));
333346
}
334347

335348
@Test
@@ -362,7 +375,8 @@ void testOrderByNestedTuple() {
362375
]
363376
}
364377
""",
365-
getBooksByIds(5, 1, 4, 2, 3));
378+
getBooksByIds(5, 1, 4, 2, 3),
379+
Set.of(Book.COLLECTION_NAME));
366380
}
367381
}
368382
}

src/main/java/com/mongodb/hibernate/internal/translate/MutationMqlTranslator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public JdbcOperationQueryMutation translate(
5454

5555
logSqlAst(mutationStatement);
5656

57-
checkJdbcParameterBindingsSupportability(jdbcParameterBindings);
5857
applyQueryOptions(queryOptions);
5958

6059
var result = acceptAndYield(mutationStatement, MUTATION_RESULT);

0 commit comments

Comments
 (0)