DATAJPA-798 - Alias detection now also works for JPQL strings containing line breaks.
We tweaked the regular expression to detect query aliases to correctly use the whitespace character class \s instead of a simple space to make sure we don't get fooled by other whitespace characters like tabs and line breaks.
This commit is contained in:
@@ -303,6 +303,14 @@ public class QueryUtilsUnitTests {
|
||||
assertThat(createCountQueryFor("select u from Usèr u"), is("select count(u) from Usèr u"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-798
|
||||
*/
|
||||
@Test
|
||||
public void detectsAliasInQueryContainingLineBreaks() {
|
||||
assertThat(detectAlias("select \n u \n from \n User \nu"), is("u"));
|
||||
}
|
||||
|
||||
private void assertCountQuery(String originalQuery, String countQuery) {
|
||||
assertThat(createCountQueryFor(originalQuery), is(countQuery));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user