mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Deprecate orderBy() migrate to order()
This commit is contained in:
@@ -53,7 +53,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase {
|
||||
DB.find(Contact.class)
|
||||
.setProfileLocation(loc0)
|
||||
.select("email, " + concat("lastName", ", ", "firstName") + " as fullName").where()
|
||||
.istartsWith(concat("lastName", ", ", "firstName"), val).orderBy().asc("lastName").setMaxRows(10)
|
||||
.istartsWith(concat("lastName", ", ", "firstName"), val).order().asc("lastName").setMaxRows(10)
|
||||
.asDto(ContactDto.class).setLabel("prefixLoop").findList();
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase {
|
||||
DtoQuery<ContactDto> query = DB.find(Contact.class)
|
||||
// we must explicitly add the id property for DTO query (if we want it)
|
||||
.select("id, email, " + concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("email")
|
||||
.isNotNull("lastName").orderBy().asc("lastName").asDto(ContactDto.class).setLabel("explicitId")
|
||||
.isNotNull("lastName").order().asc("lastName").asDto(ContactDto.class).setLabel("explicitId")
|
||||
.setRelaxedMode();
|
||||
|
||||
List<ContactDto> dtos = query.findList();
|
||||
@@ -149,7 +149,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase {
|
||||
|
||||
DtoQuery<ContactDto> query = DB.find(Contact.class)
|
||||
.select("email, " + concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("email")
|
||||
.isNotNull("lastName").orderBy().asc("lastName").asDto(ContactDto.class);
|
||||
.isNotNull("lastName").order().asc("lastName").asDto(ContactDto.class);
|
||||
|
||||
List<ContactDto> dtos = query.findList();
|
||||
|
||||
@@ -174,7 +174,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase {
|
||||
|
||||
List<ContactDto> contactDtos = DB.find(Contact.class).setLabel("emailFullName")
|
||||
.select("email, " + concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("email")
|
||||
.isNotNull("lastName").orderBy().asc("lastName").setMaxRows(10).asDto(ContactDto.class).findList();
|
||||
.isNotNull("lastName").order().asc("lastName").setMaxRows(10).asDto(ContactDto.class).findList();
|
||||
|
||||
assertThat(contactDtos).isNotEmpty();
|
||||
|
||||
@@ -204,7 +204,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase {
|
||||
|
||||
List<ContactDto> contactDtos = DB.find(Contact.class)
|
||||
.select("id, email, " + concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("email")
|
||||
.isNotNull("lastName").orderBy().asc("lastName").setMaxRows(10).asDto(ContactDto.class).findList();
|
||||
.isNotNull("lastName").order().asc("lastName").setMaxRows(10).asDto(ContactDto.class).findList();
|
||||
|
||||
assertThat(contactDtos).isNotEmpty();
|
||||
|
||||
@@ -233,7 +233,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase {
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
List<ContactDto> contactDtos = DB.find(Contact.class)
|
||||
.select(concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("lastName").orderBy()
|
||||
.select(concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("lastName").order()
|
||||
.asc("lastName").asDto(ContactDto.class).setFirstRow(2).setMaxRows(5).findList();
|
||||
|
||||
assertThat(contactDtos).isNotEmpty();
|
||||
@@ -256,7 +256,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase {
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
List<ContactTotals> contactDtos = DB.find(Contact.class).select("lastName, count(*) as totalCount").where()
|
||||
.isNotNull("lastName").having().gt("count(*)", 1).orderBy().desc("count(*)").asDto(ContactTotals.class)
|
||||
.isNotNull("lastName").having().gt("count(*)", 1).order().desc("count(*)").asDto(ContactTotals.class)
|
||||
.findList();
|
||||
|
||||
assertThat(contactDtos).isNotEmpty();
|
||||
|
||||
@@ -133,7 +133,7 @@ public class EbeanServer_eqlTest extends BaseTestCase {
|
||||
query.setMaxRows(10);
|
||||
query.setFirstRow(3);
|
||||
if (isSqlServer()) {
|
||||
query.orderBy("id");
|
||||
query.order("id");
|
||||
}
|
||||
query.findList();
|
||||
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class CachedBeanDataSerializeTest extends BaseTestCase {
|
||||
ResetBasicData.reset();
|
||||
|
||||
List<Customer> customers = Ebean.find(Customer.class)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.setMaxRows(1).findList();
|
||||
|
||||
Customer customer = customers.get(0);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class TestAggregateFormula extends BaseTestCase {
|
||||
List<Contact> contacts = Ebean.find(Contact.class)
|
||||
.setDistinct(true)
|
||||
.select("lastName, min(customer)")
|
||||
.orderBy("min(customer) asc nulls last")
|
||||
.order("min(customer) asc nulls last")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
|
||||
@@ -26,7 +26,7 @@ public class TestLazyLoadInCache extends BaseTestCase {
|
||||
.select("id, name")
|
||||
.setBeanCacheMode(CacheMode.PUT)
|
||||
.setReadOnly(true)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.findMap();
|
||||
|
||||
assertTrue(!map.isEmpty());
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TestQueryJoin extends BaseTestCase {
|
||||
|
||||
Query<Order> query = Ebean.find(Order.class).select("status")
|
||||
// .join("details","+query(10)")
|
||||
.fetch("customer", "+lazy(10) name, status").fetch("customer.contacts").orderBy().asc("id");
|
||||
.fetch("customer", "+lazy(10) name, status").fetch("customer.contacts").order().asc("id");
|
||||
// .join("customer.billingAddress");
|
||||
|
||||
List<Order> list = query.findList();
|
||||
|
||||
@@ -93,7 +93,7 @@ public class TestCKeyLazyLoad extends BaseTestCase {
|
||||
private void exerciseMaxRowsQuery_with_embeddedId() {
|
||||
|
||||
PagedList<CKeyParent> siteUserPage = Ebean.find(CKeyParent.class).where()
|
||||
.orderBy("name asc")
|
||||
.order("name asc")
|
||||
.setMaxRows(10)
|
||||
.findPagedList();
|
||||
siteUserPage.getList();
|
||||
|
||||
@@ -112,7 +112,7 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
|
||||
list = Ebean.find(BwBean.class)
|
||||
.where().bitwiseAll("flags", BwFlags.HAS_BULK + BwFlags.HAS_COLOUR)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(2);
|
||||
@@ -121,7 +121,7 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
|
||||
list = Ebean.find(BwBean.class)
|
||||
.where().bitwiseAll("flags", BwFlags.HAS_SIZE)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(2);
|
||||
@@ -130,7 +130,7 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
|
||||
list = Ebean.find(BwBean.class)
|
||||
.where().bitwiseAll("flags", BwFlags.HAS_COLOUR)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(3);
|
||||
|
||||
@@ -18,7 +18,7 @@ public class TestInheritanceBothSides extends BaseTestCase {
|
||||
@Test
|
||||
public void selectSourceBaseSql() {
|
||||
|
||||
final Query<SourceBase> query = DB.find(SourceBase.class).orderBy("pos");
|
||||
final Query<SourceBase> query = DB.find(SourceBase.class).order("pos");
|
||||
query.findList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select t0.dtype, t0.id, t0.name, t0.pos, t1.dtype, t0.target_id, t1.dtype, t0.target_id from source_base t0 left join target_base t1 on t1.id = t0.target_id order by t0.pos");
|
||||
@@ -27,7 +27,7 @@ public class TestInheritanceBothSides extends BaseTestCase {
|
||||
@Test
|
||||
public void selectSourceASql() {
|
||||
|
||||
final Query<SourceA> query = DB.find(SourceA.class).orderBy("pos");
|
||||
final Query<SourceA> query = DB.find(SourceA.class).order("pos");
|
||||
query.findList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select t0.dtype, t0.id, t0.name, t0.pos, t1.dtype, t0.target_id from source_base t0 left join target_base t1 on t1.id = t0.target_id where t0.dtype = 'SourceA' order by t0.pos");
|
||||
@@ -36,7 +36,7 @@ public class TestInheritanceBothSides extends BaseTestCase {
|
||||
@Test
|
||||
public void selectSourceAWithJoin() {
|
||||
|
||||
final Query<SourceA> query = DB.find(SourceA.class).fetch("target", "name").orderBy("pos");
|
||||
final Query<SourceA> query = DB.find(SourceA.class).fetch("target", "name").order("pos");
|
||||
query.findList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select t0.dtype, t0.id, t0.name, t0.pos, t1.dtype, t1.id, t1.name from source_base t0 left join target_base t1 on t1.id = t0.target_id where t0.dtype = 'SourceA' order by t0.pos");
|
||||
@@ -78,7 +78,7 @@ public class TestInheritanceBothSides extends BaseTestCase {
|
||||
|
||||
final List<SourceA> sourceAList = DB.find(SourceA.class)
|
||||
.fetch("target", "name")
|
||||
.orderBy("pos")
|
||||
.order("pos")
|
||||
.findList();
|
||||
|
||||
final String joinedNames = sourceAList.stream()
|
||||
@@ -99,7 +99,7 @@ public class TestInheritanceBothSides extends BaseTestCase {
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
final List<SourceBase> sources = DB.find(SourceBase.class).orderBy("pos").findList();
|
||||
final List<SourceBase> sources = DB.find(SourceBase.class).order("pos").findList();
|
||||
for (SourceBase source : sources) {
|
||||
if (source instanceof SourceA) {
|
||||
SourceA a = (SourceA) source;
|
||||
|
||||
+5
-5
@@ -103,7 +103,7 @@ public class TestCacheViaComplexNaturalKey extends BaseTestCase {
|
||||
.eq("store", storeId)
|
||||
.in("sku", skus)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
@@ -122,7 +122,7 @@ public class TestCacheViaComplexNaturalKey extends BaseTestCase {
|
||||
.eq("store", storeId)
|
||||
.in("sku", skus)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
sql = LoggedSqlCollector.current();
|
||||
@@ -141,7 +141,7 @@ public class TestCacheViaComplexNaturalKey extends BaseTestCase {
|
||||
.eq("store", storeId)
|
||||
.in("sku", skus)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
sql = LoggedSqlCollector.stop();
|
||||
@@ -171,7 +171,7 @@ public class TestCacheViaComplexNaturalKey extends BaseTestCase {
|
||||
.eq("store", storeId)
|
||||
.in("sku", skus)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
@@ -200,7 +200,7 @@ public class TestCacheViaComplexNaturalKey extends BaseTestCase {
|
||||
.eq("store", storeId)
|
||||
.in("sku", skus)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
|
||||
+4
-4
@@ -232,7 +232,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
|
||||
.in("sku", skus)
|
||||
.eq("code", 1001)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
@@ -262,7 +262,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
|
||||
.in("sku", skus)
|
||||
.eq("code", 1001)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
@@ -357,7 +357,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
|
||||
.eq("store", "def")
|
||||
.inPairs(pairs)
|
||||
.setUseCache(true)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
@@ -400,7 +400,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
|
||||
.eq("store", "def")
|
||||
.inPairs(pairs)
|
||||
.setBeanCacheMode(CacheMode.ON)
|
||||
.orderBy("sku desc")
|
||||
.order("sku desc")
|
||||
.findList();
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
|
||||
@@ -19,7 +19,7 @@ public class TestPview extends BaseTestCase {
|
||||
Query<Paggview> query = Ebean.find(Paggview.class);
|
||||
query.select("amount");
|
||||
query.where().eq("pview.wviews", wview);
|
||||
query.orderBy("pview.value");
|
||||
query.order("pview.value");
|
||||
query.findList();
|
||||
String generatedSql = sqlOf(query, 1);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class TestSelfRefExample extends BaseTestCase {
|
||||
assertThat(e3Searched.getChildren()).extracting("id").contains(e7.getId());
|
||||
|
||||
// If we get all the items, you can see the structure goes down a fair bit further.
|
||||
Query<SelfRefExample> examples2 = Ebean.createQuery(SelfRefExample.class).orderBy("id asc");
|
||||
Query<SelfRefExample> examples2 = Ebean.createQuery(SelfRefExample.class).order("id asc");
|
||||
List<SelfRefExample> list2 = examples2.findList();
|
||||
|
||||
assertEquals(e1.getId(), list2.get(0).getId());
|
||||
|
||||
@@ -34,7 +34,7 @@ public class TestTextJsonSelfRef extends BaseTestCase {
|
||||
}
|
||||
});
|
||||
|
||||
List<SelfRefCustomer> customers = Ebean.find(SelfRefCustomer.class).orderBy("id desc").findList();
|
||||
List<SelfRefCustomer> customers = Ebean.find(SelfRefCustomer.class).order("id desc").findList();
|
||||
|
||||
// Check that there are no 'reference' beans here
|
||||
for (SelfRefCustomer cust : customers) {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public class TestPersistenceContextScopeUsingOrders extends BaseTestCase {
|
||||
.setPersistenceContextScope(QUERY)
|
||||
.fetch("customer", "id, name")
|
||||
.where().istartsWith("customer.name", "rob").eq("customer.id", 1)
|
||||
.orderBy().asc("customer.name")
|
||||
.order().asc("customer.name")
|
||||
.findList();
|
||||
|
||||
assertTrue(!orders.isEmpty());
|
||||
|
||||
@@ -26,7 +26,7 @@ public class TestAddOrderByWithFirstRowsMaxRows extends BaseTestCase {
|
||||
|
||||
Ebean.find(Order.class)
|
||||
.setFirstRow(3)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
List<String> loggedSql = LoggedSqlCollector.stop();
|
||||
@@ -66,7 +66,7 @@ public class TestAddOrderByWithFirstRowsMaxRows extends BaseTestCase {
|
||||
Ebean.find(Order.class)
|
||||
.setFirstRow(3)
|
||||
.setMaxRows(10)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
List<String> loggedSql = LoggedSqlCollector.stop();
|
||||
@@ -126,7 +126,7 @@ public class TestAddOrderByWithFirstRowsMaxRows extends BaseTestCase {
|
||||
Ebean.find(Order.class)
|
||||
.setFirstRow(10)
|
||||
.setMaxRows(10)
|
||||
.orderBy("id")
|
||||
.order("id")
|
||||
.findPagedList()
|
||||
.getList();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TestExprNestedDisjunction extends BaseTestCase {
|
||||
.disjunction()
|
||||
.conjunction().startsWith("name", "r").eq("anniversary", onAfter).endJunction()
|
||||
.conjunction().eq("status", Customer.Status.ACTIVE).gt("id", 0).endJunction()
|
||||
.orderBy().asc("name");
|
||||
.order().asc("name");
|
||||
|
||||
q.findList();
|
||||
String s = q.getGeneratedSql();
|
||||
@@ -46,7 +46,7 @@ public class TestExprNestedDisjunction extends BaseTestCase {
|
||||
.startsWith("name", "r").eq("anniversary", onAfter).endAnd()
|
||||
.and()
|
||||
.eq("status", Customer.Status.ACTIVE).gt("id", 0).endAnd()
|
||||
.orderBy().asc("name");
|
||||
.order().asc("name");
|
||||
|
||||
q.findList();
|
||||
String s = q.getGeneratedSql();
|
||||
@@ -68,7 +68,7 @@ public class TestExprNestedDisjunction extends BaseTestCase {
|
||||
.gt("id", 1)
|
||||
.eq("anniversary", onAfter)
|
||||
.endNot()
|
||||
.orderBy().asc("name");
|
||||
.order().asc("name");
|
||||
|
||||
q.findList();
|
||||
String s = q.getGeneratedSql();
|
||||
@@ -90,7 +90,7 @@ public class TestExprNestedDisjunction extends BaseTestCase {
|
||||
.not()
|
||||
.gt("id", 1)
|
||||
.eq("anniversary", onAfter)
|
||||
.orderBy().asc("name");
|
||||
.order().asc("name");
|
||||
|
||||
q.findList();
|
||||
String s = q.getGeneratedSql();
|
||||
@@ -114,7 +114,7 @@ public class TestExprNestedDisjunction extends BaseTestCase {
|
||||
.eq("anniversary", onAfter)
|
||||
.endNot()
|
||||
.endOr()
|
||||
.orderBy().asc("name");
|
||||
.order().asc("name");
|
||||
|
||||
q.findList();
|
||||
String s = q.getGeneratedSql();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestLimitAlterFetchMany extends BaseTestCase {
|
||||
Query<Customer> query = Ebean.find(Customer.class)
|
||||
// this will automatically get converted to a
|
||||
// query join ... due to the maxRows
|
||||
.fetch("contacts").setMaxRows(5).orderBy("id");
|
||||
.fetch("contacts").setMaxRows(5).order("id");
|
||||
|
||||
List<Customer> list = query.findList();
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TestManyWhereJoin extends BaseTestCase {
|
||||
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.where().eq("details.product.id", productId)
|
||||
.orderBy("cretime asc");
|
||||
.order("cretime asc");
|
||||
|
||||
query.findList();
|
||||
String sql = sqlOf(query, 3);
|
||||
@@ -123,7 +123,7 @@ public class TestManyWhereJoin extends BaseTestCase {
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
//.fetch("details")
|
||||
.where().eq("details.product", product)
|
||||
.orderBy("cretime asc");
|
||||
.order("cretime asc");
|
||||
|
||||
query.findList();
|
||||
String sql = sqlOf(query, 3);
|
||||
@@ -157,7 +157,7 @@ public class TestManyWhereJoin extends BaseTestCase {
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.fetch("details")
|
||||
.where().eq("details.product", product)
|
||||
.orderBy("cretime asc");
|
||||
.order("cretime asc");
|
||||
|
||||
query.findList();
|
||||
String sql = sqlOf(query, 3);
|
||||
|
||||
@@ -155,7 +155,7 @@ public class TestOuterJoin extends BaseTestCase {
|
||||
|
||||
LoggedSql.start();
|
||||
|
||||
List<Order> orders1 = Ebean.find(Order.class).orderBy("id").findList();
|
||||
List<Order> orders1 = Ebean.find(Order.class).order("id").findList();
|
||||
|
||||
assertThat(LoggedSql.collect().get(0))
|
||||
.contains(" join o_customer") // ensure that we do not left join the customer
|
||||
@@ -166,7 +166,7 @@ public class TestOuterJoin extends BaseTestCase {
|
||||
LoggedSql.start();
|
||||
|
||||
List<Order> orders2 = Ebean.find(Order.class)
|
||||
.fetch("details", "id").orderBy("id").findList();
|
||||
.fetch("details", "id").order("id").findList();
|
||||
|
||||
assertThat(LoggedSql.collect().get(0))
|
||||
.contains(" left join o_order_detail ");
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TestQueryFilterMany extends BaseTestCase {
|
||||
|
||||
Customer customer = Ebean.find(Customer.class)
|
||||
.setMaxRows(1)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.fetch("orders")
|
||||
.filterMany("orders").raw("1 = 0")
|
||||
.findOne();
|
||||
@@ -66,7 +66,7 @@ public class TestQueryFilterMany extends BaseTestCase {
|
||||
|
||||
Optional<Customer> customer = Ebean.find(Customer.class)
|
||||
.setMaxRows(1)
|
||||
.orderBy().asc("id")
|
||||
.order().asc("id")
|
||||
.fetch("orders")
|
||||
.filterMany("orders").raw("1 = 0")
|
||||
.findOneOrEmpty();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestQueryFindEach extends BaseTestCase {
|
||||
Query<Customer> query
|
||||
= server.find(Customer.class)
|
||||
.setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
@@ -48,7 +48,7 @@ public class TestQueryFindEach extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestQueryFindEachWhile extends BaseTestCase {
|
||||
Query<Customer> query
|
||||
= server.find(Customer.class)
|
||||
.setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
@@ -49,7 +49,7 @@ public class TestQueryFindEachWhile extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@@ -108,7 +108,7 @@ public class TestQueryFindPagedList extends BaseTestCase {
|
||||
PagedList<Order> pagedList2 = Ebean.find(Order.class)
|
||||
.setFirstRow(1)
|
||||
.setMaxRows(3)
|
||||
.orderBy("id")
|
||||
.order("id")
|
||||
.findPagedList();
|
||||
|
||||
pagedList2.loadCount();
|
||||
@@ -124,7 +124,7 @@ public class TestQueryFindPagedList extends BaseTestCase {
|
||||
PagedList<Order> pagedList3 = Ebean.find(Order.class)
|
||||
.setFirstRow(2)
|
||||
.setMaxRows(150)
|
||||
.orderBy("id")
|
||||
.order("id")
|
||||
.findPagedList();
|
||||
|
||||
assertFalse(pagedList3.hasNext());
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TestQueryFindVisit extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
@@ -43,7 +43,7 @@ public class TestQueryFindVisit extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class TestQueryOrderById extends BaseTestCase {
|
||||
|
||||
Query<Customer> query = DB.find(Customer.class)
|
||||
.select("id,name")
|
||||
.orderBy("id")
|
||||
.order("id")
|
||||
.setFirstRow(1)
|
||||
.setMaxRows(5);
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public class TestAggregationCount extends BaseTestCase {
|
||||
.startsWith("logs.description", "a")
|
||||
.having()
|
||||
.ge("count", 1)
|
||||
.orderBy().asc("name");
|
||||
.order().asc("name");
|
||||
|
||||
List<TEventOne> list = query2.findList();
|
||||
for (TEventOne eventOne : list) {
|
||||
@@ -125,7 +125,7 @@ public class TestAggregationCount extends BaseTestCase {
|
||||
|
||||
Query<TEventOne> query = Ebean.find(TEventOne.class)
|
||||
.select("name, count, totalUnits, totalAmount")
|
||||
.orderBy().asc("totalUnits").order().asc("name");
|
||||
.order().asc("totalUnits").order().asc("name");
|
||||
|
||||
List<TEventOne> list = query.findList();
|
||||
assertThat(list).isNotEmpty();
|
||||
@@ -184,7 +184,7 @@ public class TestAggregationCount extends BaseTestCase {
|
||||
Query<TEventOne> query1 = Ebean.find(TEventOne.class)
|
||||
.select("name, count, totalUnits, totalAmount")
|
||||
.having().ge("count", 1)
|
||||
.orderBy().asc("name");
|
||||
.order().asc("name");
|
||||
|
||||
query1.findList();
|
||||
assertThat(query1.getGeneratedSql()).contains("having count(u1.id) >= ? order by t0.name");
|
||||
@@ -403,7 +403,7 @@ public class TestAggregationCount extends BaseTestCase {
|
||||
Ebean.find(Contact.class)
|
||||
.select(concat("lastName",", ","firstName"))
|
||||
.where().isNull("phone")
|
||||
.orderBy().asc("lastName")
|
||||
.order().asc("lastName")
|
||||
.findSingleAttributeList();
|
||||
|
||||
assertThat(names).isNotEmpty();
|
||||
@@ -424,7 +424,7 @@ public class TestAggregationCount extends BaseTestCase {
|
||||
Ebean.find(Contact.class)
|
||||
.select(concat("updtime",", ","firstName")+"::String")
|
||||
.where().isNull("phone")
|
||||
.orderBy().asc("lastName")
|
||||
.order().asc("lastName")
|
||||
.findSingleAttributeList();
|
||||
|
||||
assertThat(names).isNotEmpty();
|
||||
@@ -466,7 +466,7 @@ public class TestAggregationCount extends BaseTestCase {
|
||||
Ebean.find(Contact.class)
|
||||
.select("email, " + concat("lastName",", ","firstName") + " as lastName")
|
||||
.where().isNull("phone")
|
||||
.orderBy().asc("lastName")
|
||||
.order().asc("lastName")
|
||||
.findList();
|
||||
|
||||
assertThat(contacts).isNotEmpty();
|
||||
|
||||
@@ -19,10 +19,10 @@ public class TestOrderByClear extends BaseTestCase {
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.orderBy().asc("orderDate");
|
||||
.order().asc("orderDate");
|
||||
|
||||
|
||||
OrderBy<Order> orderBy = query.orderBy();
|
||||
OrderBy<Order> orderBy = query.order();
|
||||
assertTrue(orderBy.containsProperty("orderDate"));
|
||||
|
||||
orderBy.clear();
|
||||
|
||||
@@ -34,7 +34,7 @@ public class TestOrderByOnComplex extends BaseTestCase {
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.orderBy("case when status=3 then 10 when status=2 then 11 else 99 end");
|
||||
.order("case when status=3 then 10 when status=2 then 11 else 99 end");
|
||||
|
||||
List<Order> list = query.findList();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
.where()
|
||||
.eq("junk", "blah")
|
||||
.eq("name", "jim")
|
||||
.orderBy("id desc,path.that.does.not.exist,contacts.group.name asc");
|
||||
.order("id desc,path.that.does.not.exist,contacts.group.name asc");
|
||||
|
||||
Set<String> unknownProperties = query.validate();
|
||||
assertThat(unknownProperties).isNotEmpty();
|
||||
@@ -49,7 +49,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
Query<MUser> query = Ebean.find(MUser.class)
|
||||
.where()
|
||||
.eq("roles", role)
|
||||
.orderBy("userName asc nulls first");
|
||||
.order("userName asc nulls first");
|
||||
|
||||
query.findList();
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
.fetch("userType", "name")
|
||||
.where()
|
||||
.eq("roles.roleName", "A")
|
||||
.orderBy("userType.name, userName");
|
||||
.order("userType.name, userName");
|
||||
List<MUser> list = query.findList();
|
||||
|
||||
// select distinct t0.userid c0, t0.user_name c1, t1.id c2, t1.name c3
|
||||
@@ -158,7 +158,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
.fetch("userType", "name")
|
||||
.where()
|
||||
.eq("roles.roleName", "A")
|
||||
.orderBy("userType.name");
|
||||
.order("userType.name");
|
||||
list = query.findList();
|
||||
|
||||
Assert.assertEquals(1, list.size());
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TestQueryConversationRowCount extends BaseTestCase {
|
||||
.endJunction()
|
||||
.eq("open", true)
|
||||
.endJunction()
|
||||
.orderBy("whenCreated desc");
|
||||
.order("whenCreated desc");
|
||||
|
||||
query.findList();
|
||||
String generatedSql = sqlOf(query, 1);
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TestQueryRowCountWithMany extends BaseTestCase {
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.fetch("details")
|
||||
.where().eq("details.product.id", productId)
|
||||
.orderBy("cretime asc");
|
||||
.order("cretime asc");
|
||||
|
||||
List<Order> list = query.findList();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.setDistinct(true)
|
||||
.select("name")
|
||||
.where().eq("status", Customer.Status.NEW)
|
||||
.orderBy().asc("name")
|
||||
.order().asc("name")
|
||||
.setMaxRows(100)
|
||||
.findSingleAttributeList();
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.setDistinct(true)
|
||||
.select("anniversary")
|
||||
.where().isNotNull("anniversary")
|
||||
.orderBy().asc("anniversary")
|
||||
.order().asc("anniversary")
|
||||
.findSingleAttributeList();
|
||||
|
||||
assertThat(dates).isNotNull();
|
||||
@@ -368,7 +368,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
Query<Contact> query = Ebean.find(Contact.class)
|
||||
.setDistinct(true)
|
||||
.select("customer")
|
||||
.orderBy().desc("customer");
|
||||
.order().desc("customer");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
|
||||
@@ -383,7 +383,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
Query<Contact> query = Ebean.find(Contact.class)
|
||||
.setDistinct(true)
|
||||
.select("customer.id")
|
||||
.orderBy().desc("customer.id");
|
||||
.order().desc("customer.id");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
|
||||
@@ -398,7 +398,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
Query<Contact> query = Ebean.find(Contact.class)
|
||||
.setDistinct(true)
|
||||
.fetch("customer", "billingAddress")
|
||||
.orderBy().desc("customer.billingAddress");
|
||||
.order().desc("customer.billingAddress");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
|
||||
@@ -414,7 +414,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.setDistinct(true)
|
||||
.fetch("customer", "billingAddress")
|
||||
.where().eq("customer.billingAddress.city", "Auckland")
|
||||
.orderBy().desc("customer.billingAddress.id");
|
||||
.order().desc("customer.billingAddress.id");
|
||||
|
||||
List<Integer> ids = query.findSingleAttributeList();
|
||||
assertThat(ids).isNotEmpty();
|
||||
@@ -435,7 +435,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.setDistinct(true)
|
||||
.fetch("customer", "billingAddress")
|
||||
.where().eq("customer.billingAddress.city", "Auckland")
|
||||
.orderBy().desc("customer.billingAddress.id");
|
||||
.order().desc("customer.billingAddress.id");
|
||||
|
||||
List<Short> ids = query.findSingleAttributeList();
|
||||
assertThat(ids).isNotEmpty();
|
||||
@@ -456,7 +456,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.setDistinct(true)
|
||||
.fetch("customer", "billingAddress")
|
||||
.where().eq("customer.billingAddress.city", "Auckland")
|
||||
.orderBy().desc("customer.billingAddress.id");
|
||||
.order().desc("customer.billingAddress.id");
|
||||
|
||||
List<Integer> ids = query.findSingleAttributeList();
|
||||
assertThat(ids).isNotEmpty();
|
||||
@@ -477,7 +477,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.setDistinct(true)
|
||||
.fetch("customer", "billingAddress")
|
||||
.where().eq("customer.shippingAddress.city", "Auckland") // query on shippingAddress
|
||||
.orderBy().desc("customer.billingAddress.id");
|
||||
.order().desc("customer.billingAddress.id");
|
||||
|
||||
List<Short> ids = query.findSingleAttributeList();
|
||||
assertThat(ids).isNotEmpty();
|
||||
|
||||
@@ -151,7 +151,7 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
|
||||
|
||||
query.setFirstRow(1);
|
||||
query.setMaxRows(2);
|
||||
query.orderBy("id");
|
||||
query.order("id");
|
||||
|
||||
List<Customer> list = query.findList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user