Skip to content

Commit c8ef7b4

Browse files
committed
Use fully qualified names in ORDER BY clause.
Closes #680
1 parent 0ad751e commit c8ef7b4

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/test/java/org/springframework/data/r2dbc/core/R2dbcEntityTemplateUnitTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void shouldSelectByCriteria() {
155155
StatementRecorder.RecordedStatement statement = recorder.getCreatedStatement(s -> s.startsWith("SELECT"));
156156

157157
assertThat(statement.getSql())
158-
.isEqualTo("SELECT person.* FROM person WHERE person.THE_NAME = $1 ORDER BY THE_NAME ASC");
158+
.isEqualTo("SELECT person.* FROM person WHERE person.THE_NAME = $1 ORDER BY person.THE_NAME ASC");
159159
assertThat(statement.getBindings()).hasSize(1).containsEntry(0, Parameter.from("Walter"));
160160
}
161161

@@ -196,7 +196,7 @@ void shouldSelectOne() {
196196
StatementRecorder.RecordedStatement statement = recorder.getCreatedStatement(s -> s.startsWith("SELECT"));
197197

198198
assertThat(statement.getSql())
199-
.isEqualTo("SELECT person.* FROM person WHERE person.THE_NAME = $1 ORDER BY THE_NAME ASC LIMIT 2");
199+
.isEqualTo("SELECT person.* FROM person WHERE person.THE_NAME = $1 ORDER BY person.THE_NAME ASC LIMIT 2");
200200
assertThat(statement.getBindings()).hasSize(1).containsEntry(0, Parameter.from("Walter"));
201201
}
202202

src/test/java/org/springframework/data/r2dbc/core/StatementMapperUnitTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void shouldMapSelectWithPage() {
7777

7878
PreparedOperation<?> preparedOperation = mapper.getMappedObject(selectSpec);
7979

80-
assertThat(preparedOperation.toQuery()).isEqualTo("SELECT table.* FROM table ORDER BY id DESC LIMIT 2 OFFSET 2");
80+
assertThat(preparedOperation.toQuery())
81+
.isEqualTo("SELECT table.* FROM table ORDER BY table.id DESC LIMIT 2 OFFSET 2");
8182
}
8283
}

src/test/java/org/springframework/data/r2dbc/repository/query/PartTreeR2dbcQueryUnitTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ void createsQueryToFindAllEntitiesByIntegerAttributeWithDescendingOrderingByStri
430430
PreparedOperation<?> preparedOperation = createQuery(r2dbcQuery, accessor);
431431

432432
assertThat(preparedOperation.get())
433-
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age = $1 ORDER BY last_name DESC");
433+
.isEqualTo(
434+
"SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age = $1 ORDER BY users.last_name DESC");
434435
}
435436

436437
@Test // gh-282
@@ -442,7 +443,8 @@ void createsQueryToFindAllEntitiesByIntegerAttributeWithAscendingOrderingByStrin
442443
PreparedOperation<?> preparedOperation = createQuery(r2dbcQuery, accessor);
443444

444445
assertThat(preparedOperation.get())
445-
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age = $1 ORDER BY last_name ASC");
446+
.isEqualTo(
447+
"SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age = $1 ORDER BY users.last_name ASC");
446448
}
447449

448450
@Test // gh-282

0 commit comments

Comments
 (0)