@@ -113,7 +113,7 @@ void shouldMapSomeNestedCriteria() {
113
113
114
114
BoundCondition bindings = map (criteria );
115
115
116
- assertThat (bindings .getCondition ()).hasToString ("((person.name = ?[$1]))" );
116
+ assertThat (bindings .getCondition ()).hasToString ("((person.\" NAME \" = ?[$1]))" );
117
117
}
118
118
119
119
@ Test // gh-289
@@ -133,8 +133,10 @@ void shouldMapNestedGroup() {
133
133
134
134
BoundCondition bindings = map (criteria );
135
135
136
+ // name is a property and therefore gets the normal quoting behaviour.
137
+ // age is not a property and terefore gets used as is.
136
138
assertThat (bindings .getCondition ()).hasToString (
137
- "(person.name = ?[$1]) AND (person.name = ?[$2] OR person.age < ?[$3] OR (person.name != ?[$4] AND person.age > ?[$5]))" );
139
+ "(person.\" NAME \" = ?[$1]) AND (person.\" NAME \" = ?[$2] OR person.age < ?[$3] OR (person.\" NAME \" != ?[$4] AND person.age > ?[$5]))" );
138
140
}
139
141
140
142
@ Test // gh-289
@@ -150,7 +152,7 @@ void shouldMapFrom() {
150
152
BoundCondition bindings = map (criteria );
151
153
152
154
assertThat (bindings .getCondition ())
153
- .hasToString ("person.name = ?[$1] AND (person.name = ?[$2] OR person.age < ?[$3])" );
155
+ .hasToString ("person.\" NAME \" = ?[$1] AND (person.\" NAME \" = ?[$2] OR person.age < ?[$3])" );
154
156
}
155
157
156
158
@ Test // gh-383
@@ -160,13 +162,13 @@ void shouldMapFromConcat() {
160
162
.or ("age" ).lessThan (49 ));
161
163
162
164
assertThat (map (criteria ).getCondition ())
163
- .hasToString ("(person.name = ?[$1] AND (person.name = ?[$2] OR person.age < ?[$3]))" );
165
+ .hasToString ("(person.\" NAME \" = ?[$1] AND (person.\" NAME \" = ?[$2] OR person.age < ?[$3]))" );
164
166
165
167
criteria = Criteria .from (Criteria .where ("name" ).is ("Foo" ), Criteria .where ("name" ).is ("Bar" ) //
166
168
.or ("age" ).lessThan (49 ), Criteria .where ("foo" ).is ("bar" ));
167
169
168
170
assertThat (map (criteria ).getCondition ())
169
- .hasToString ("(person.name = ?[$1] AND (person.name = ?[$2] OR person.age < ?[$3]) AND (person.foo = ?[$4]))" );
171
+ .hasToString ("(person.\" NAME \" = ?[$1] AND (person.\" NAME \" = ?[$2] OR person.age < ?[$3]) AND (person.foo = ?[$4]))" );
170
172
}
171
173
172
174
@ Test // gh-64
@@ -176,7 +178,7 @@ void shouldMapSimpleCriteria() {
176
178
177
179
BoundCondition bindings = map (criteria );
178
180
179
- assertThat (bindings .getCondition ()).hasToString ("person.name = ?[$1]" );
181
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" = ?[$1]" );
180
182
181
183
bindings .getBindings ().apply (bindTarget );
182
184
verify (bindTarget ).bind (0 , "foo" );
@@ -218,7 +220,7 @@ void shouldMapExpression() {
218
220
Expression mappedObject = mapper .getMappedObject (table .column ("alternative" ).as ("my_aliased_col" ),
219
221
mapper .getMappingContext ().getRequiredPersistentEntity (Person .class ));
220
222
221
- assertThat (mappedObject ).hasToString ("my_aliased_table.another_name AS my_aliased_col" );
223
+ assertThat (mappedObject ).hasToString ("my_aliased_table.\" another_name\" AS my_aliased_col" );
222
224
}
223
225
224
226
@ Test // gh-300
@@ -229,7 +231,7 @@ void shouldMapCountFunction() {
229
231
Expression mappedObject = mapper .getMappedObject (Functions .count (table .column ("alternative" )),
230
232
mapper .getMappingContext ().getRequiredPersistentEntity (Person .class ));
231
233
232
- assertThat (mappedObject ).hasToString ("COUNT(my_aliased_table.another_name)" );
234
+ assertThat (mappedObject ).hasToString ("COUNT(my_aliased_table.\" another_name\" )" );
233
235
}
234
236
235
237
@ Test // gh-300
@@ -260,7 +262,7 @@ void shouldMapSimpleNullableCriteria() {
260
262
261
263
BoundCondition bindings = map (criteria );
262
264
263
- assertThat (bindings .getCondition ()).hasToString ("person.name = ?[$1]" );
265
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" = ?[$1]" );
264
266
265
267
bindings .getBindings ().apply (bindTarget );
266
268
verify (bindTarget ).bindNull (0 , Integer .class );
@@ -273,7 +275,7 @@ void shouldConsiderColumnName() {
273
275
274
276
BoundCondition bindings = map (criteria );
275
277
276
- assertThat (bindings .getCondition ()).hasToString ("person.another_name = ?[$1]" );
278
+ assertThat (bindings .getCondition ()).hasToString ("person.\" another_name\" = ?[$1]" );
277
279
}
278
280
279
281
@ Test // gh-64
@@ -283,7 +285,7 @@ void shouldMapAndCriteria() {
283
285
284
286
BoundCondition bindings = map (criteria );
285
287
286
- assertThat (bindings .getCondition ()).hasToString ("person.name = ?[$1] AND person.bar = ?[$2]" );
288
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" = ?[$1] AND person.bar = ?[$2]" );
287
289
288
290
bindings .getBindings ().apply (bindTarget );
289
291
verify (bindTarget ).bind (0 , "foo" );
@@ -297,7 +299,7 @@ void shouldMapOrCriteria() {
297
299
298
300
BoundCondition bindings = map (criteria );
299
301
300
- assertThat (bindings .getCondition ()).hasToString ("person.name = ?[$1] OR person.bar = ?[$2]" );
302
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" = ?[$1] OR person.bar = ?[$2]" );
301
303
}
302
304
303
305
@ Test // gh-64
@@ -311,7 +313,7 @@ void shouldMapAndOrCriteria() {
311
313
BoundCondition bindings = map (criteria );
312
314
313
315
assertThat (bindings .getCondition ()).hasToString (
314
- "person.name = ?[$1] AND person.name IS NOT NULL OR person.bar = ?[$2] AND person.anotherOne = ?[$3]" );
316
+ "person.\" NAME \" = ?[$1] AND person.\" NAME \" IS NOT NULL OR person.bar = ?[$2] AND person.anotherOne = ?[$3]" );
315
317
}
316
318
317
319
@ Test // gh-64
@@ -321,7 +323,7 @@ void shouldMapNeq() {
321
323
322
324
BoundCondition bindings = map (criteria );
323
325
324
- assertThat (bindings .getCondition ()).hasToString ("person.name != ?[$1]" );
326
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" != ?[$1]" );
325
327
}
326
328
327
329
@ Test // gh-64
@@ -331,7 +333,7 @@ void shouldMapIsNull() {
331
333
332
334
BoundCondition bindings = map (criteria );
333
335
334
- assertThat (bindings .getCondition ()).hasToString ("person.name IS NULL" );
336
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" IS NULL" );
335
337
}
336
338
337
339
@ Test // gh-64
@@ -341,7 +343,7 @@ void shouldMapIsNotNull() {
341
343
342
344
BoundCondition bindings = map (criteria );
343
345
344
- assertThat (bindings .getCondition ()).hasToString ("person.name IS NOT NULL" );
346
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" IS NOT NULL" );
345
347
}
346
348
347
349
@ Test // gh-64
@@ -351,7 +353,7 @@ void shouldMapIsIn() {
351
353
352
354
BoundCondition bindings = map (criteria );
353
355
354
- assertThat (bindings .getCondition ()).hasToString ("person.name IN (?[$1], ?[$2], ?[$3])" );
356
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" IN (?[$1], ?[$2], ?[$3])" );
355
357
}
356
358
357
359
@ Test // gh-64, gh-177
@@ -361,7 +363,7 @@ void shouldMapIsNotIn() {
361
363
362
364
BoundCondition bindings = map (criteria );
363
365
364
- assertThat (bindings .getCondition ()).hasToString ("person.name NOT IN (?[$1], ?[$2], ?[$3])" );
366
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" NOT IN (?[$1], ?[$2], ?[$3])" );
365
367
}
366
368
367
369
@ Test
@@ -374,7 +376,7 @@ void shouldMapIsNotInWithCollectionToStringConverter() {
374
376
375
377
BoundCondition bindings = map (criteria );
376
378
377
- assertThat (bindings .getCondition ()).hasToString ("person.name NOT IN (?[$1], ?[$2], ?[$3])" );
379
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" NOT IN (?[$1], ?[$2], ?[$3])" );
378
380
}
379
381
380
382
@ Test // gh-64
@@ -384,7 +386,7 @@ void shouldMapIsGt() {
384
386
385
387
BoundCondition bindings = map (criteria );
386
388
387
- assertThat (bindings .getCondition ()).hasToString ("person.name > ?[$1]" );
389
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" > ?[$1]" );
388
390
}
389
391
390
392
@ Test // gh-64
@@ -394,7 +396,7 @@ void shouldMapIsGte() {
394
396
395
397
BoundCondition bindings = map (criteria );
396
398
397
- assertThat (bindings .getCondition ()).hasToString ("person.name >= ?[$1]" );
399
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" >= ?[$1]" );
398
400
}
399
401
400
402
@ Test // gh-64
@@ -404,7 +406,7 @@ void shouldMapIsLt() {
404
406
405
407
BoundCondition bindings = map (criteria );
406
408
407
- assertThat (bindings .getCondition ()).hasToString ("person.name < ?[$1]" );
409
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" < ?[$1]" );
408
410
}
409
411
410
412
@ Test // gh-64
@@ -414,7 +416,7 @@ void shouldMapIsLte() {
414
416
415
417
BoundCondition bindings = map (criteria );
416
418
417
- assertThat (bindings .getCondition ()).hasToString ("person.name <= ?[$1]" );
419
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" <= ?[$1]" );
418
420
}
419
421
420
422
@ Test // gh-64
@@ -424,7 +426,7 @@ void shouldMapIsLike() {
424
426
425
427
BoundCondition bindings = map (criteria );
426
428
427
- assertThat (bindings .getCondition ()).hasToString ("person.name LIKE ?[$1]" );
429
+ assertThat (bindings .getCondition ()).hasToString ("person.\" NAME \" LIKE ?[$1]" );
428
430
}
429
431
430
432
@ Test // GH-1507
@@ -493,7 +495,7 @@ void mapQueryForEnumArrayShouldMapToStringList() {
493
495
494
496
BoundCondition bindings = map (criteria );
495
497
496
- assertThat (bindings .getCondition ()).hasToString ("person.enum_value IN (?[$1], ?[$2])" );
498
+ assertThat (bindings .getCondition ()).hasToString ("person.\" ENUM_VALUE \" IN (?[$1], ?[$2])" );
497
499
}
498
500
499
501
@ Test // gh-733
@@ -503,7 +505,7 @@ void shouldMapBooleanConditionProperly() {
503
505
504
506
BoundCondition bindings = map (criteria );
505
507
506
- assertThat (bindings .getCondition ()).hasToString ("person.state = ?[$1]" );
508
+ assertThat (bindings .getCondition ()).hasToString ("person.\" STATE \" = ?[$1]" );
507
509
assertThat (bindings .getBindings ().iterator ().next ().getValue ()).isEqualTo (false );
508
510
}
509
511
@@ -515,7 +517,7 @@ void shouldMapAndConvertBooleanConditionProperly() {
515
517
516
518
BoundCondition bindings = map (criteria );
517
519
518
- assertThat (bindings .getCondition ()).hasToString ("person.state = ?[$1]" );
520
+ assertThat (bindings .getCondition ()).hasToString ("person.\" STATE \" = ?[$1]" );
519
521
assertThat (bindings .getBindings ().iterator ().next ().getValue ()).isEqualTo ((byte ) 1 );
520
522
}
521
523
@@ -526,7 +528,7 @@ void shouldMapJsonNodeToString() {
526
528
527
529
BoundCondition bindings = map (criteria );
528
530
529
- assertThat (bindings .getCondition ()).hasToString ("person.json_node = ?[$1]" );
531
+ assertThat (bindings .getCondition ()).hasToString ("person.\" JSON_NODE \" = ?[$1]" );
530
532
assertThat (bindings .getBindings ().iterator ().next ().getValue ()).isEqualTo ("foo" );
531
533
}
532
534
@@ -537,7 +539,7 @@ void shouldMapJsonNodeListToString() {
537
539
538
540
BoundCondition bindings = map (criteria );
539
541
540
- assertThat (bindings .getCondition ()).hasToString ("person.json_node IN (?[$1], ?[$2])" );
542
+ assertThat (bindings .getCondition ()).hasToString ("person.\" JSON_NODE \" IN (?[$1], ?[$2])" );
541
543
assertThat (bindings .getBindings ().iterator ().next ().getValue ()).isEqualTo ("foo" );
542
544
}
543
545
0 commit comments