mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#3379 Followup, Move orderById() to common QueryBuilder interface
Effectively this adds it to QueryBeans (where it was missing)
This commit is contained in:
@@ -582,6 +582,12 @@ public abstract class TQRootBean<T, R> implements QueryBean<T, R> {
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R orderById(boolean orderById) {
|
||||
query.orderById(orderById);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated(since = "13.19", forRemoval = true)
|
||||
public final R order(String orderByClause) {
|
||||
|
||||
@@ -79,6 +79,28 @@ class QOrderTest {
|
||||
DB.delete(customer);
|
||||
}
|
||||
|
||||
@Test
|
||||
void orderById() {
|
||||
Query<Order> query = new QOrder()
|
||||
.select(QOrder.Alias.status)
|
||||
.orderById(true).query();
|
||||
|
||||
query.findList();
|
||||
|
||||
String sql = query.getGeneratedSql();
|
||||
assertThat(sql).contains("select /* QOrderTest.orderById:88 */ t0.id, t0.status from o_order t0 order by t0.id");
|
||||
|
||||
Query<Order> query2 = new QOrder()
|
||||
.select(QOrder.Alias.status)
|
||||
.orderById(true).orderBy().status.asc()
|
||||
.query();
|
||||
|
||||
query2.findList();
|
||||
|
||||
String sql2 = query2.getGeneratedSql();
|
||||
assertThat(sql2).contains("select /* QOrderTest.orderById:98 */ t0.id, t0.status from o_order t0 order by t0.status, t0.id");
|
||||
}
|
||||
|
||||
@Test
|
||||
void hint() {
|
||||
LoggedSql.start();
|
||||
|
||||
Reference in New Issue
Block a user