File tree 2 files changed +26
-3
lines changed
main/java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query
2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2013-2014 the original author or authors.
2
+ * Copyright 2013-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -255,7 +255,6 @@ private final String parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQu
255
255
checkAndRegister (new InParameterBinding (parameterName , expression ), bindings );
256
256
}
257
257
258
- result = query ;
259
258
break ;
260
259
261
260
case AS_IS : // fall-through we don't need a special parameter binding for the given parameter.
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2013-2014 the original author or authors.
2
+ * Copyright 2013-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -312,7 +312,31 @@ public void detectsInBindingWithSpecialCharactersAndWordCharactersMixedInParenth
312
312
public void rejectsDifferentBindingsForRepeatedParameter2 () {
313
313
new StringQuery ("select u from User u where u.firstname like ?1 and u.lastname like %?1" );
314
314
}
315
+
316
+ /**
317
+ * @see @DATAJPA-712
318
+ */
319
+ @ Test
320
+ public void shouldReplaceAllNamedExpressionParametersWithInClause () {
321
+
322
+ StringQuery query = new StringQuery ("select a from A a where a.b in :#{#bs} and a.c in :#{#cs}" );
323
+ String queryString = query .getQueryString ();
324
+
325
+ assertThat (queryString , is ("select a from A a where a.b in :__$synthetic$__1 and a.c in :__$synthetic$__2" ));
326
+ }
315
327
328
+ /**
329
+ * @see @DATAJPA-712
330
+ */
331
+ @ Test
332
+ public void shouldReplaceAllPositionExpressionParametersWithInClause () {
333
+
334
+ StringQuery query = new StringQuery ("select a from A a where a.b in ?#{#bs} and a.c in ?#{#cs}" );
335
+ String queryString = query .getQueryString ();
336
+
337
+ assertThat (queryString , is ("select a from A a where a.b in ?1 and a.c in ?2" ));
338
+ }
339
+
316
340
private void assertPositionalBinding (Class <? extends ParameterBinding > bindingType , Integer position ,
317
341
ParameterBinding expectedBinding ) {
318
342
You can’t perform that action at this time.
0 commit comments