|
1 | 1 | /*
|
2 |
| - * Copyright 2008-2014 the original author or authors. |
| 2 | + * Copyright 2008-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.
|
@@ -150,11 +150,13 @@ public void detectsJoinAliasesCorrectly() {
|
150 | 150 | assertThat(aliases, hasSize(1));
|
151 | 151 | assertThat(aliases, hasItems("b2_$ar"));
|
152 | 152 |
|
153 |
| - aliases = getOuterJoinAliases("select p from Person p left outer join x.foo as b2_$ar, left join x.bar as foo where …"); |
| 153 | + aliases = getOuterJoinAliases( |
| 154 | + "select p from Person p left outer join x.foo as b2_$ar, left join x.bar as foo where …"); |
154 | 155 | assertThat(aliases, hasSize(2));
|
155 | 156 | assertThat(aliases, hasItems("b2_$ar", "foo"));
|
156 | 157 |
|
157 |
| - aliases = getOuterJoinAliases("select p from Person p left join x.foo as b2_$ar, left outer join x.bar foo where …"); |
| 158 | + aliases = getOuterJoinAliases( |
| 159 | + "select p from Person p left join x.foo as b2_$ar, left outer join x.bar foo where …"); |
158 | 160 | assertThat(aliases, hasSize(2));
|
159 | 161 | assertThat(aliases, hasItems("b2_$ar", "foo"));
|
160 | 162 | }
|
@@ -281,6 +283,18 @@ public void createCountQueryFromTheGivenCountProjection() {
|
281 | 283 | is("select count(p.lastname) from Person p"));
|
282 | 284 | }
|
283 | 285 |
|
| 286 | + /** |
| 287 | + * @see DATAJPA-726 |
| 288 | + */ |
| 289 | + @Test |
| 290 | + public void detectsAliassesInPlainJoins() { |
| 291 | + |
| 292 | + String query = "select p from Customer c join c.productOrder p where p.delayed = true"; |
| 293 | + Sort sort = new Sort("p.lineItems"); |
| 294 | + |
| 295 | + assertThat(applySorting(query, sort, "c"), endsWith("order by p.lineItems asc")); |
| 296 | + } |
| 297 | + |
284 | 298 | private void assertCountQuery(String originalQuery, String countQuery) {
|
285 | 299 | assertThat(createCountQueryFor(originalQuery), is(countQuery));
|
286 | 300 | }
|
|
0 commit comments