From c379abda50d7bdbad12275496adaabeaf92e9c56 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Thu, 24 Oct 2024 13:39:27 +0200 Subject: [PATCH 1/7] Replaced .order() with .orderBy() No effective code change, just replaced the deprecated .order() with the .orderBy() --- ebean-api/src/main/java/io/ebean/DB.java | 2 +- .../src/main/java/io/ebean/Database.java | 2 +- .../main/java/io/ebean/ExpressionList.java | 10 +++--- ebean-api/src/main/java/io/ebean/Finder.java | 2 +- .../src/main/java/io/ebean/Junction.java | 2 +- .../src/main/java/io/ebean/PagedList.java | 2 +- ebean-api/src/main/java/io/ebean/Pairs.java | 2 +- ebean-api/src/main/java/io/ebean/Query.java | 2 +- .../src/main/java/io/ebean/QueryIterator.java | 2 +- ebean-api/src/main/java/io/ebean/RawSql.java | 2 +- .../java/io/ebean/text/json/package-info.java | 2 +- .../server/deploy/BeanDescriptor.java | 4 +-- .../expression/FilterExpressionList.java | 2 +- .../server/grammer/EqlAdapter.java | 2 +- .../server/query/CQueryEngine.java | 2 +- .../server/querydefn/OrmQueryPlanKeyTest.java | 8 ++--- .../io/ebean/typequery/TQPropertyBase.java | 4 +-- .../ebean/xtest/base/DtoQueryFromOrmTest.java | 12 +++---- .../ebean/xtest/base/EbeanServer_eqlTest.java | 4 +-- .../text/json/TestJsonWriteVisitor.java | 2 +- .../json/TestTextJsonBeanReadVisitor.java | 2 +- .../TestAggregateFormula.java | 2 +- .../java/org/tests/basic/MainDbBoolean.java | 4 +-- .../org/tests/basic/TestLazyLoadInCache.java | 2 +- .../java/org/tests/basic/TestLimitQuery.java | 2 +- .../org/tests/basic/TestLoadBeanCache.java | 2 +- .../org/tests/basic/TestManyLazyLoad.java | 2 +- .../tests/basic/TestQueryWhereBetween.java | 6 ++-- .../org/tests/batchload/TestBasicLazy.java | 4 +-- .../batchload/TestBatchLazyWithCacheHits.java | 2 +- .../batchload/TestBatchLazyWithDeleted.java | 2 +- .../org/tests/batchload/TestBeanState.java | 4 +-- .../org/tests/batchload/TestLazyJoin.java | 2 +- .../org/tests/batchload/TestLazyJoin2.java | 6 ++-- .../batchload/TestQueryDisableLazyLoad.java | 6 ++-- .../org/tests/batchload/TestQueryJoin.java | 2 +- .../batchload/TestQueryJoinToAssocOne.java | 4 +-- .../tests/cache/TestCacheCollectionIds.java | 2 +- .../tests/cache/TestQueryCacheCountry.java | 10 +++--- .../tests/compositekeys/TestCKeyLazyLoad.java | 2 +- .../org/tests/compositekeys/TestCore.java | 4 +-- .../tests/draftable/LinkQueryPublishTest.java | 2 +- .../bitwise/TestBitwiseExpressions.java | 16 +++++----- .../TestInheritanceBatchLazyLoad.java | 2 +- .../bothsides/TestInheritanceBothSides.java | 10 +++--- .../org/tests/level/test/ManyToManyTest.java | 6 ++-- .../tests/m2m/TestM2MDistinct_sqlServer.java | 2 +- .../softdelete/TestM2MSoftDeleteExists.java | 6 ++-- .../cache/TestCacheViaComplexNaturalKey.java | 10 +++--- .../cache/TestCacheViaComplexNaturalKey3.java | 16 +++++----- .../TestElementCollectionBasic.java | 4 +-- .../TestElementCollectionBasicMap.java | 4 +-- .../TestElementCollectionBasicSet.java | 4 +-- .../TestElementCollectionEmbeddedList.java | 4 +-- .../TestElementCollectionEmbeddedMap.java | 4 +-- .../java/org/tests/model/pview/TestPview.java | 2 +- .../model/selfref/TestSelfRefExample.java | 4 +-- .../model/selfref/TestTextJsonSelfRef.java | 2 +- ...estPersistenceContextScopeUsingOrders.java | 2 +- .../TestAddOrderByWithFirstRowsMaxRows.java | 12 +++---- .../query/TestExprNestedDisjunction.java | 10 +++--- .../tests/query/TestLimitAlterFetchMany.java | 2 +- .../org/tests/query/TestManyWhereJoin.java | 6 ++-- .../java/org/tests/query/TestOuterJoin.java | 4 +-- .../query/TestQueryFetchJoinWithOrder.java | 10 +++--- .../org/tests/query/TestQueryFilterMany.java | 32 +++++++++---------- .../org/tests/query/TestQueryFindEach.java | 4 +-- .../tests/query/TestQueryFindEachWhile.java | 4 +-- .../org/tests/query/TestQueryFindIterate.java | 6 ++-- .../tests/query/TestQueryFindPagedList.java | 4 +-- .../org/tests/query/TestQueryOrderById.java | 2 +- .../query/TestQueryPathJoinAndOrder.java | 2 +- .../query/TestQueryPlanCacheRowCount.java | 4 +-- .../java/org/tests/query/TestRowCount.java | 2 +- .../aggregation/TestAggregationCount.java | 12 +++---- .../query/joins/TestQueryJoinOnFormula.java | 4 +-- .../tests/query/orderby/TestOrderByClear.java | 12 +++---- .../query/orderby/TestOrderByOnComplex.java | 4 +-- .../orderby/TestOrderByWithDistinct.java | 8 ++--- .../orderby/TestOrderByWithDistinctTake2.java | 4 +-- .../orderby/TestOrderByWithFunction.java | 2 +- .../query/orderby/TestOrderByWithMany.java | 14 ++++---- .../other/TestQueryConversationRowCount.java | 2 +- .../other/TestQueryRowCountWithMany.java | 2 +- .../query/other/TestQuerySingleAttribute.java | 18 +++++------ .../query/other/TestWhereAnnotation.java | 2 +- .../org/tests/rawsql/TestRawSqlOrmQuery.java | 12 +++---- .../tests/rawsql/TestRawSqlOrmWrapper2.java | 2 +- .../json/TestTextJsonBeanReadVisitor.java | 2 +- .../json/TestTextJsonReadManyLazyLoad.java | 6 ++-- .../text/json/TestTextJsonReferenceBean.java | 2 +- .../tests/text/json/TestTextJsonSimple.java | 6 ++-- .../text/json/TestTextJsonSuperSimple.java | 2 +- .../update/TestUpdateAllLoadedProperties.java | 2 +- 94 files changed, 232 insertions(+), 232 deletions(-) diff --git a/ebean-api/src/main/java/io/ebean/DB.java b/ebean-api/src/main/java/io/ebean/DB.java index d8b68e7ad4..e00ffde094 100644 --- a/ebean-api/src/main/java/io/ebean/DB.java +++ b/ebean-api/src/main/java/io/ebean/DB.java @@ -605,7 +605,7 @@ public static T reference(Class beanType, Object id) { * // find orders and their customers * List list = DB.find(Order.class) * .fetch("customer") - * .order("id") + * .orderBy("id") * .findList(); * * // sort by customer name ascending, then by order shipDate diff --git a/ebean-api/src/main/java/io/ebean/Database.java b/ebean-api/src/main/java/io/ebean/Database.java index 8fee6929a3..b708223009 100644 --- a/ebean-api/src/main/java/io/ebean/Database.java +++ b/ebean-api/src/main/java/io/ebean/Database.java @@ -400,7 +400,7 @@ static DatabaseBuilder builder() { * // find orders and their customers * List list = database.find(Order.class) * .fetch("customer") - * .order("id") + * .orderBy("id") * .findList(); * * // sort by customer name ascending, then by order shipDate diff --git a/ebean-api/src/main/java/io/ebean/ExpressionList.java b/ebean-api/src/main/java/io/ebean/ExpressionList.java index b830a12693..32d679a07f 100644 --- a/ebean-api/src/main/java/io/ebean/ExpressionList.java +++ b/ebean-api/src/main/java/io/ebean/ExpressionList.java @@ -355,7 +355,7 @@ default OrderBy order() { * List names = * DB.find(Customer.class) * .select("name") - * .order().asc("name") + * .orderBy().asc("name") * .findSingleAttributeList(); * * } @@ -368,7 +368,7 @@ default OrderBy order() { * .setDistinct(true) * .select("name") * .where().eq("status", Customer.Status.NEW) - * .order().asc("name") + * .orderBy().asc("name") * .setMaxRows(100) * .findSingleAttributeList(); * @@ -1713,7 +1713,7 @@ default ExpressionList isIn(String propertyName, Collection values) { * .eq("status", Customer.Status.ACTIVE) * .gt("id", 0) * .endAnd() - * .order().asc("name") + * .orderBy().asc("name") * .findList(); * } */ @@ -1734,7 +1734,7 @@ default ExpressionList isIn(String propertyName, Collection values) { * .or() * .eq("status", Customer.Status.ACTIVE) * .isNull("anniversary") - * .order().asc("name") + * .orderBy().asc("name") * .findList(); * * } @@ -1754,7 +1754,7 @@ default ExpressionList isIn(String propertyName, Collection values) { * .eq("status", Customer.Status.ACTIVE) * .gt("id", 0) * .endAnd() - * .order().asc("name") + * .orderBy().asc("name") * .findList(); * * } diff --git a/ebean-api/src/main/java/io/ebean/Finder.java b/ebean-api/src/main/java/io/ebean/Finder.java index 0e98dfdc29..6492aaa24e 100644 --- a/ebean-api/src/main/java/io/ebean/Finder.java +++ b/ebean-api/src/main/java/io/ebean/Finder.java @@ -35,7 +35,7 @@ * public List findNew() { * return query().where() * .eq("status", Customer.Status.NEW) - * .order("name") + * .orderBy("name") * .findList() * } * } diff --git a/ebean-api/src/main/java/io/ebean/Junction.java b/ebean-api/src/main/java/io/ebean/Junction.java index b1bec8d76c..93422a6aca 100644 --- a/ebean-api/src/main/java/io/ebean/Junction.java +++ b/ebean-api/src/main/java/io/ebean/Junction.java @@ -61,7 +61,7 @@ * .eq("status", Customer.Status.ACTIVE) * .gt("id", 0) * .endAnd() - * .order().asc("name"); + * .orderBy().asc("name"); * * q.findList(); * String s = q.getGeneratedSql(); diff --git a/ebean-api/src/main/java/io/ebean/PagedList.java b/ebean-api/src/main/java/io/ebean/PagedList.java index f4e1d3610c..3b8a0d4d40 100644 --- a/ebean-api/src/main/java/io/ebean/PagedList.java +++ b/ebean-api/src/main/java/io/ebean/PagedList.java @@ -25,7 +25,7 @@ * * PagedList pagedList = DB.find(Order.class) * .where().eq("status", Order.Status.NEW) - * .order().asc("id") + * .orderBy().asc("id") * .setFirstRow(0) * .setMaxRows(50) * .findPagedList(); diff --git a/ebean-api/src/main/java/io/ebean/Pairs.java b/ebean-api/src/main/java/io/ebean/Pairs.java index 05da36deb9..ab34ab68c0 100644 --- a/ebean-api/src/main/java/io/ebean/Pairs.java +++ b/ebean-api/src/main/java/io/ebean/Pairs.java @@ -30,7 +30,7 @@ * .where() * .eq("store", "def") * .inPairs(pairs) // IN clause with 'pairs' of values - * .order("sku desc") + * .orderBy("sku desc") * * // query expressions cover the natural key properties * // so we can choose to hit the L2 bean cache if we want diff --git a/ebean-api/src/main/java/io/ebean/Query.java b/ebean-api/src/main/java/io/ebean/Query.java index abc8358980..c064e7232a 100644 --- a/ebean-api/src/main/java/io/ebean/Query.java +++ b/ebean-api/src/main/java/io/ebean/Query.java @@ -13,7 +13,7 @@ * .where() * .like("customer.name","rob%") * .gt("orderDate",lastWeek) - * .order("customer.id, id desc") + * .orderBy("customer.id, id desc") * .setMaxRows(50) * .findList(); * diff --git a/ebean-api/src/main/java/io/ebean/QueryIterator.java b/ebean-api/src/main/java/io/ebean/QueryIterator.java index 6ad5231511..e5576142c8 100644 --- a/ebean-api/src/main/java/io/ebean/QueryIterator.java +++ b/ebean-api/src/main/java/io/ebean/QueryIterator.java @@ -25,7 +25,7 @@ * * Query query = database.find(Customer.class) * .where().gt("id", 0) - * .order("id") + * .orderBy("id") * .setMaxRows(2); * * QueryIterator it = query.findIterate(); diff --git a/ebean-api/src/main/java/io/ebean/RawSql.java b/ebean-api/src/main/java/io/ebean/RawSql.java index 901f1a43ce..27db1a401b 100644 --- a/ebean-api/src/main/java/io/ebean/RawSql.java +++ b/ebean-api/src/main/java/io/ebean/RawSql.java @@ -111,7 +111,7 @@ * .fetch("order.customer", "name") * .where().gt("order.id", 0) * .having().gt("totalAmount", 20) - * .order().desc("totalAmount") + * .orderBy().desc("totalAmount") * .setMaxRows(10) * .findList(); * diff --git a/ebean-api/src/main/java/io/ebean/text/json/package-info.java b/ebean-api/src/main/java/io/ebean/text/json/package-info.java index 62badf6796..f6241fe9ad 100644 --- a/ebean-api/src/main/java/io/ebean/text/json/package-info.java +++ b/ebean-api/src/main/java/io/ebean/text/json/package-info.java @@ -15,7 +15,7 @@ * .fetch("billingAddress","line1, city") * .fetch("billingAddress.country", "*") * .fetch("contacts", "firstName,email") - * .order().desc("id") + * .orderBy().desc("id") * .findList(); * * JsonContext json = DB.json(); diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java index b0988c2e35..da8173117f 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java @@ -3186,8 +3186,8 @@ public void diff(String prefix, Map map, EntityBean newBean, * provides unique ordering of the rows (so that the paging is predicable). */ public void appendOrderById(SpiQuery query) { - if (idProperty != null && !idProperty.isEmbedded() && !query.order().containsProperty(idProperty.name())) { - query.order().asc(idProperty.name()); + if (idProperty != null && !idProperty.isEmbedded() && !query.orderBy().containsProperty(idProperty.name())) { + query.orderBy().asc(idProperty.name()); } } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/expression/FilterExpressionList.java b/ebean-core/src/main/java/io/ebeaninternal/server/expression/FilterExpressionList.java index c12b79fe18..e9d5c6c434 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/expression/FilterExpressionList.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/expression/FilterExpressionList.java @@ -172,7 +172,7 @@ public void applyRowLimits(SpiQuery query) { query.setMaxRows(maxRows); } if (orderByClause != null) { - query.order(orderByClause); + query.orderBy(orderByClause); } } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlAdapter.java b/ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlAdapter.java index d1fe3b6f5b..77287903b5 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlAdapter.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlAdapter.java @@ -152,7 +152,7 @@ public void enterOrderby_property(EQLParser.Orderby_propertyContext ctx) { } } - query.order().add(new OrderBy.Property(path, asc, nulls, nullsFirstLast)); + query.orderBy().add(new OrderBy.Property(path, asc, nulls, nullsFirstLast)); } @Override diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java index 2a51dd515e..cb70d75742 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java @@ -240,7 +240,7 @@ public List> findVersions(OrmQueryRequest request) { } // order by lower sys period desc - query.order().desc(sysPeriodLower); + query.orderBy().desc(sysPeriodLower); CQuery cquery = queryBuilder.buildQuery(request); request.setCancelableQuery(cquery); try { diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/querydefn/OrmQueryPlanKeyTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/querydefn/OrmQueryPlanKeyTest.java index fbe02353d3..e9b704ca3c 100644 --- a/ebean-core/src/test/java/io/ebeaninternal/server/querydefn/OrmQueryPlanKeyTest.java +++ b/ebean-core/src/test/java/io/ebeaninternal/server/querydefn/OrmQueryPlanKeyTest.java @@ -151,11 +151,11 @@ public void equals_when_diffDisableLazyLoading() { @Test public void equals_when_diffOrderByNull() { - CQueryPlanKey key1 = planKey(query().order("id")); + CQueryPlanKey key1 = planKey(query().orderBy("id")); CQueryPlanKey key2 = planKey(query()); assertDifferent(key1, key2); - key1 = planKey(query().order().asc("id")); + key1 = planKey(query().orderBy().asc("id")); key2 = planKey(query()); assertDifferent(key1, key2); } @@ -163,8 +163,8 @@ public void equals_when_diffOrderByNull() { @Test public void equals_when_orderBySame() { - CQueryPlanKey key1 = planKey(query().order("id, name")); - CQueryPlanKey key2 = planKey(query().order("id, name")); + CQueryPlanKey key1 = planKey(query().orderBy("id, name")); + CQueryPlanKey key2 = planKey(query().orderBy("id, name")); assertSame(key1, key2); } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java b/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java index e6123fa155..f57813cef6 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java @@ -29,7 +29,7 @@ public TQPropertyBase(String name, R root, String prefix) { * Order by ascending on this property. */ public final R asc() { - expr().order().asc(_name); + expr().orderBy().asc(_name); return _root; } @@ -37,7 +37,7 @@ public final R asc() { * Order by descending on this property. */ public final R desc() { - expr().order().desc(_name); + expr().orderBy().desc(_name); return _root; } diff --git a/ebean-test/src/test/java/io/ebean/xtest/base/DtoQueryFromOrmTest.java b/ebean-test/src/test/java/io/ebean/xtest/base/DtoQueryFromOrmTest.java index 503f561eef..ddf5acca68 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/base/DtoQueryFromOrmTest.java +++ b/ebean-test/src/test/java/io/ebean/xtest/base/DtoQueryFromOrmTest.java @@ -57,7 +57,7 @@ public void testPlanHits() { DB.find(Contact.class) .setProfileLocation(loc0) .select("email, " + concat("lastName", ", ", "firstName") + " as fullName").where() - .istartsWith(concat("lastName", ", ", "firstName"), val).order().asc("lastName").setMaxRows(10) + .istartsWith(concat("lastName", ", ", "firstName"), val).orderBy().asc("lastName").setMaxRows(10) .asDto(ContactDto.class).setLabel("prefixLoop").findList(); } @@ -196,7 +196,7 @@ public void asDto_withoutSelectClause() { LoggedSql.start(); DtoQuery query = DB.find(Contact.class) - .where().isNotNull("email").order().asc("lastName") + .where().isNotNull("email").orderBy().asc("lastName") .asDto(ContactDto2.class) .setRelaxedMode(); @@ -226,7 +226,7 @@ public void asDto_withoutExplicitId() { .where() .isNotNull("email") .isNotNull("lastName") - .order().asc("lastName") + .orderBy().asc("lastName") .asDto(ContactDto.class); List dtos = query.findList(); @@ -288,7 +288,7 @@ public void example_explicitId() { List contactDtos = DB.find(Contact.class) .select("id, email, " + concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("email") - .isNotNull("lastName").order().asc("lastName").setMaxRows(10).asDto(ContactDto.class).findList(); + .isNotNull("lastName").orderBy().asc("lastName").setMaxRows(10).asDto(ContactDto.class).findList(); assertThat(contactDtos).isNotEmpty(); @@ -317,7 +317,7 @@ public void example_singleProperty() { LoggedSql.start(); List contactDtos = DB.find(Contact.class) - .select(concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("lastName").order() + .select(concat("lastName", ", ", "firstName") + " as fullName").where().isNotNull("lastName").orderBy() .asc("lastName").asDto(ContactDto.class).setFirstRow(2).setMaxRows(5).findList(); assertThat(contactDtos).isNotEmpty(); @@ -340,7 +340,7 @@ public void example_aggregate() { LoggedSql.start(); List contactDtos = DB.find(Contact.class).select("lastName, count(*) as totalCount").where() - .isNotNull("lastName").having().gt("count(*)", 1).order().desc("count(*)").asDto(ContactTotals.class) + .isNotNull("lastName").having().gt("count(*)", 1).orderBy().desc("count(*)").asDto(ContactTotals.class) .findList(); assertThat(contactDtos).isNotEmpty(); diff --git a/ebean-test/src/test/java/io/ebean/xtest/base/EbeanServer_eqlTest.java b/ebean-test/src/test/java/io/ebean/xtest/base/EbeanServer_eqlTest.java index f6c3ff9367..dbb9d2fa3a 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/base/EbeanServer_eqlTest.java +++ b/ebean-test/src/test/java/io/ebean/xtest/base/EbeanServer_eqlTest.java @@ -133,7 +133,7 @@ public void basic_limit_offset3() { query.setMaxRows(10); query.setFirstRow(3); if (isSqlServer()) { - query.order("id"); + query.orderBy("id"); } query.findList(); @@ -213,7 +213,7 @@ public void namedQuery_withStatus() { ResetBasicData.reset(); Query name = server().createNamedQuery(Customer.class, "withStatus"); - name.order().clear().asc("status"); + name.orderBy().clear().asc("status"); name.findList(); assertThat(sqlOf(name, 2)).contains("select t0.id, t0.name, t0.status from o_customer t0 order by t0.status"); diff --git a/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestJsonWriteVisitor.java b/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestJsonWriteVisitor.java index 2c66288c77..8413ef8b2f 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestJsonWriteVisitor.java +++ b/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestJsonWriteVisitor.java @@ -26,7 +26,7 @@ public void test() { .fetch("billingAddress", "line1, city") .fetch("billingAddress.country", "*") .fetch("contacts", "firstName,email") - .order().desc("id") + .orderBy().desc("id") .findList(); JsonContext json = DB.json(); diff --git a/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestTextJsonBeanReadVisitor.java b/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestTextJsonBeanReadVisitor.java index 72efba9d16..3a364c42cc 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestTextJsonBeanReadVisitor.java +++ b/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/TestTextJsonBeanReadVisitor.java @@ -30,7 +30,7 @@ public void test() { .fetch("billingAddress", "line1, city") .fetch("billingAddress.country", "*") .fetch("contacts", "firstName,email") - .order().desc("id") + .orderBy().desc("id") .findList(); JsonContext json = DB.json(); diff --git a/ebean-test/src/test/java/org/tests/aggregateformula/TestAggregateFormula.java b/ebean-test/src/test/java/org/tests/aggregateformula/TestAggregateFormula.java index a1dca6a5d6..ca3c8faa46 100644 --- a/ebean-test/src/test/java/org/tests/aggregateformula/TestAggregateFormula.java +++ b/ebean-test/src/test/java/org/tests/aggregateformula/TestAggregateFormula.java @@ -26,7 +26,7 @@ public void minDistinctOrderByNulls() { List contacts = DB.find(Contact.class) .setDistinct(true) .select("lastName, min(customer)") - .order("min(customer) asc nulls last") + .orderBy("min(customer) asc nulls last") .findList(); List sql = LoggedSql.stop(); diff --git a/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java b/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java index ddb240ad46..985fb31f42 100644 --- a/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java +++ b/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java @@ -118,7 +118,7 @@ private void simpleCheck(Database server) { List list = server.find(TOne.class) .setAutoTune(false) - .order("id") + .orderBy("id") .findList(); assertThat(list).hasSize(2); @@ -135,7 +135,7 @@ private void simpleCheck(Database server) { Query query = server.find(TOne.class) .setAutoTune(false) - .order("id"); + .orderBy("id"); int rc = query.findCount(); assertThat(rc).isGreaterThan(0); diff --git a/ebean-test/src/test/java/org/tests/basic/TestLazyLoadInCache.java b/ebean-test/src/test/java/org/tests/basic/TestLazyLoadInCache.java index 71a9b0bed2..8594cb032a 100644 --- a/ebean-test/src/test/java/org/tests/basic/TestLazyLoadInCache.java +++ b/ebean-test/src/test/java/org/tests/basic/TestLazyLoadInCache.java @@ -25,7 +25,7 @@ public void testLoadInCache() { .select("id, name") .setBeanCacheMode(CacheMode.PUT) .setReadOnly(true) - .order().asc("id") + .orderBy().asc("id") .findMap(); assertFalse(map.isEmpty()); diff --git a/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java b/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java index 7e28ce9555..dd538eda40 100644 --- a/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java +++ b/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java @@ -36,7 +36,7 @@ public void testMaxRowsZeroWithFirstRow() { .where().gt("details.id", 0) .setMaxRows(0) .setFirstRow(3) - .order().asc("orderDate"); + .orderBy().asc("orderDate"); query.findList(); diff --git a/ebean-test/src/test/java/org/tests/basic/TestLoadBeanCache.java b/ebean-test/src/test/java/org/tests/basic/TestLoadBeanCache.java index 2dea13ede4..c3d4620d21 100644 --- a/ebean-test/src/test/java/org/tests/basic/TestLoadBeanCache.java +++ b/ebean-test/src/test/java/org/tests/basic/TestLoadBeanCache.java @@ -36,7 +36,7 @@ void testLoad() { .setBeanCacheMode(CacheMode.PUT) .setUseQueryCache(true) .setReadOnly(true) - .order("name") + .orderBy("name") .findMap(); Country loadedNz = map.get("NZ"); diff --git a/ebean-test/src/test/java/org/tests/basic/TestManyLazyLoad.java b/ebean-test/src/test/java/org/tests/basic/TestManyLazyLoad.java index f08304c900..1b398cabd8 100644 --- a/ebean-test/src/test/java/org/tests/basic/TestManyLazyLoad.java +++ b/ebean-test/src/test/java/org/tests/basic/TestManyLazyLoad.java @@ -21,7 +21,7 @@ public void testLazyLoadRef() throws InterruptedException { awaitL2Cache(); - List list = DB.find(Order.class).order().asc("id").findList(); + List list = DB.find(Order.class).orderBy().asc("id").findList(); assertFalse(list.isEmpty()); // just use the first one diff --git a/ebean-test/src/test/java/org/tests/basic/TestQueryWhereBetween.java b/ebean-test/src/test/java/org/tests/basic/TestQueryWhereBetween.java index 5c72400fca..bb358b48d2 100644 --- a/ebean-test/src/test/java/org/tests/basic/TestQueryWhereBetween.java +++ b/ebean-test/src/test/java/org/tests/basic/TestQueryWhereBetween.java @@ -25,7 +25,7 @@ public void testCountOrderBy() { Timestamp t = new Timestamp(System.currentTimeMillis()); Query query = DB.find(Order.class).setAutoTune(false).where() - .betweenProperties("cretime", "updtime", t).order().asc("orderDate").order().desc("id"); + .betweenProperties("cretime", "updtime", t).orderBy().asc("orderDate").orderBy().desc("id"); query.findList(); @@ -91,8 +91,8 @@ private void someQuery() { Query query = DB.find(Order.class).setAutoTune(false) .where() .le("cretime", t) - .order().asc("orderDate") - .order().desc("id"); + .orderBy().asc("orderDate") + .orderBy().desc("id"); query.findList(); diff --git a/ebean-test/src/test/java/org/tests/batchload/TestBasicLazy.java b/ebean-test/src/test/java/org/tests/batchload/TestBasicLazy.java index 9c1787dd46..5511da05be 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestBasicLazy.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestBasicLazy.java @@ -22,7 +22,7 @@ public void testQueries() { ResetBasicData.reset(); - Order order = DB.find(Order.class).select("totalAmount").setMaxRows(1).order("id") + Order order = DB.find(Order.class).select("totalAmount").setMaxRows(1).orderBy("id") .findOne(); assertNotNull(order); @@ -70,7 +70,7 @@ public void test_N1N() { public void testRaceCondition_Simple() throws Throwable { ResetBasicData.reset(); - Order order = DB.find(Order.class).select("totalAmount").setMaxRows(1).order("id") + Order order = DB.find(Order.class).select("totalAmount").setMaxRows(1).orderBy("id") .findOne(); assertNotNull(order); diff --git a/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithCacheHits.java b/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithCacheHits.java index 64028f220f..5673da3367 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithCacheHits.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithCacheHits.java @@ -46,7 +46,7 @@ public void testOnCacheHit() { List list = DB.find(UUOne.class) .select("id") .where().startsWith("name", "testBLWCH") - .order("name") + .orderBy("name") .findList(); // invoke lazy loading diff --git a/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithDeleted.java b/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithDeleted.java index d323c7e709..0e70604858 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithDeleted.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestBatchLazyWithDeleted.java @@ -47,7 +47,7 @@ public void testOnDeleted() { List list = DB.find(UUTwo.class) .fetchLazy("master") .where().startsWith("name", "two-bld-") - .order("name") + .orderBy("name") .findList(); // delete a bean that will be batch lazy loaded but diff --git a/ebean-test/src/test/java/org/tests/batchload/TestBeanState.java b/ebean-test/src/test/java/org/tests/batchload/TestBeanState.java index 66afee0245..7b3e5a4a0c 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestBeanState.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestBeanState.java @@ -72,7 +72,7 @@ void test() { @Test void setDisableLazyLoad_expect_lazyLoadingDisabled() { - List custs = DB.find(Customer.class).order("id").findList(); + List custs = DB.find(Customer.class).orderBy("id").findList(); Customer customer = DB.find(Customer.class) .setId(custs.get(0).getId()) @@ -88,7 +88,7 @@ void setDisableLazyLoad_expect_lazyLoadingDisabled() { @Test void changedProps_when_setManyProperty() { - Customer customer = DB.find(Customer.class).order("id").setMaxRows(1).findOne(); + Customer customer = DB.find(Customer.class).orderBy("id").setMaxRows(1).findOne(); BeanState beanState = DB.beanState(customer); assertThat(beanState.changedProps()).isEmpty(); diff --git a/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin.java b/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin.java index c607988a27..df9b6b0cca 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin.java @@ -24,7 +24,7 @@ public void testLazyOnNonLoaded() { .select("status") .fetchLazy("customer", "name, status") .fetch("customer.contacts") - .order().asc("id"); + .orderBy().asc("id"); List list = query.findList(); diff --git a/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin2.java b/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin2.java index 0812553430..03b5ffe041 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin2.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestLazyJoin2.java @@ -25,7 +25,7 @@ public void testLazyOnNonLoaded() { .fetchQuery("customer", "name") .fetch("customer.contacts", "firstName, lastName, mobile") - .fetch("customer.shippingAddress", "line1, city").order().asc("id").findList(); + .fetch("customer.shippingAddress", "line1, city").orderBy().asc("id").findList(); Order o0 = l0.get(0); Customer c0 = o0.getCustomer(); @@ -40,7 +40,7 @@ public void testLazyOnNonLoaded() { List orders = DB.find(Order.class) // .select("status") - .fetchQuery("customer").order().asc("id").findList(); + .fetchQuery("customer").orderBy().asc("id").findList(); // .join("customer.contacts"); // List list = query.findList(); @@ -58,7 +58,7 @@ public void testLazyOnNonLoaded() { List list = DB.find(Order.class).fetchLazy("customer", "name") .fetch("customer.contacts", "contactName, phone, email").fetch("customer.shippingAddress") - .where().eq("status", Order.Status.NEW).order().asc("id").findList(); + .where().eq("status", Order.Status.NEW).orderBy().asc("id").findList(); Order order2 = list.get(0); Customer customer2 = order2.getCustomer(); diff --git a/ebean-test/src/test/java/org/tests/batchload/TestQueryDisableLazyLoad.java b/ebean-test/src/test/java/org/tests/batchload/TestQueryDisableLazyLoad.java index 5c0c2d2d3e..0ac8cc6be1 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestQueryDisableLazyLoad.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestQueryDisableLazyLoad.java @@ -25,7 +25,7 @@ public void onAssocMany() { List l0 = DB.find(Order.class) .setDisableLazyLoading(true) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(l0).isNotEmpty(); @@ -51,7 +51,7 @@ public void onAssocOne() { List l0 = DB.find(Order.class) .setDisableLazyLoading(true) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(l0).isNotEmpty(); @@ -75,7 +75,7 @@ public void onAssocOne_when_partial() { List l0 = DB.find(Order.class) .setDisableLazyLoading(true) .fetch("customer", "smallnote") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(l0).isNotEmpty(); diff --git a/ebean-test/src/test/java/org/tests/batchload/TestQueryJoin.java b/ebean-test/src/test/java/org/tests/batchload/TestQueryJoin.java index 219dc18e23..7faca1e1a6 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestQueryJoin.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestQueryJoin.java @@ -30,7 +30,7 @@ public void test() { Query query = DB.find(Order.class).select("status") .fetchLazy("customer", "name, status") - .fetch("customer.contacts").order().asc("id"); + .fetch("customer.contacts").orderBy().asc("id"); List list = query.findList(); diff --git a/ebean-test/src/test/java/org/tests/batchload/TestQueryJoinToAssocOne.java b/ebean-test/src/test/java/org/tests/batchload/TestQueryJoinToAssocOne.java index 56e547d6d1..e04a18c59d 100644 --- a/ebean-test/src/test/java/org/tests/batchload/TestQueryJoinToAssocOne.java +++ b/ebean-test/src/test/java/org/tests/batchload/TestQueryJoinToAssocOne.java @@ -84,7 +84,7 @@ public void testQueryJoinOnPartiallyPopulatedParent_withLazyLoadingDisabled() { .select("status, shipDate") .fetchQuery("details", "orderQty, unitPrice") .fetch("details.product", "sku, name") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(l0).isNotEmpty(); @@ -122,7 +122,7 @@ public void disableLazyLoading_when_oneToManyList() { List l0 = DB.find(Order.class) .setDisableLazyLoading(true) .select("status, shipDate") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(l0).isNotEmpty(); diff --git a/ebean-test/src/test/java/org/tests/cache/TestCacheCollectionIds.java b/ebean-test/src/test/java/org/tests/cache/TestCacheCollectionIds.java index 65c2efb13d..259cbd8a05 100644 --- a/ebean-test/src/test/java/org/tests/cache/TestCacheCollectionIds.java +++ b/ebean-test/src/test/java/org/tests/cache/TestCacheCollectionIds.java @@ -33,7 +33,7 @@ void test() { custManyIdsCache.clear(); List list = DB.find(Customer.class).setAutoTune(false).setBeanCacheMode(CacheMode.PUT) - .order().asc("id").findList(); + .orderBy().asc("id").findList(); assertTrue(list.size() > 1); // Assert.assertEquals(list.size(), diff --git a/ebean-test/src/test/java/org/tests/cache/TestQueryCacheCountry.java b/ebean-test/src/test/java/org/tests/cache/TestQueryCacheCountry.java index 34f51511be..0ecd2a8517 100644 --- a/ebean-test/src/test/java/org/tests/cache/TestQueryCacheCountry.java +++ b/ebean-test/src/test/java/org/tests/cache/TestQueryCacheCountry.java @@ -35,7 +35,7 @@ public void emptyQueryResult_expect_cached() { List countryList0 = DB.find(Country.class) .setUseQueryCache(true) .where().startsWith("name", "XLKMG") - .order().asc("name") + .orderBy().asc("name") .findList(); assertThat(countryList0).isEmpty(); @@ -47,7 +47,7 @@ public void emptyQueryResult_expect_cached() { List countryList1 = DB.find(Country.class) .setUseQueryCache(true) .where().startsWith("name", "XLKMG") - .order().asc("name") + .orderBy().asc("name") .findList(); assertThat(countryList1).isEmpty(); @@ -124,7 +124,7 @@ public void test() { List countryList0 = DB.find(Country.class) .setUseQueryCache(true) - .order().asc("name") + .orderBy().asc("name") .findList(); assertEquals(1, queryCache.statistics(false).getSize()); @@ -132,7 +132,7 @@ public void test() { List countryList1 = DB.find(Country.class) .setUseQueryCache(true) - .order().asc("name") + .orderBy().asc("name") .findList(); ServerCacheStatistics statistics = queryCache.statistics(false); @@ -150,7 +150,7 @@ public void test() { List countryList2 = DB.find(Country.class) .setUseQueryCache(true) - .order().asc("name") + .orderBy().asc("name") .findList(); assertNotSame(countryList2, countryList0); diff --git a/ebean-test/src/test/java/org/tests/compositekeys/TestCKeyLazyLoad.java b/ebean-test/src/test/java/org/tests/compositekeys/TestCKeyLazyLoad.java index d2f2082969..a5d69246fd 100644 --- a/ebean-test/src/test/java/org/tests/compositekeys/TestCKeyLazyLoad.java +++ b/ebean-test/src/test/java/org/tests/compositekeys/TestCKeyLazyLoad.java @@ -93,7 +93,7 @@ public void test() { private void exerciseMaxRowsQuery_with_embeddedId() { PagedList siteUserPage = DB.find(CKeyParent.class).where() - .order("name asc") + .orderBy("name asc") .setMaxRows(10) .findPagedList(); siteUserPage.getList(); diff --git a/ebean-test/src/test/java/org/tests/compositekeys/TestCore.java b/ebean-test/src/test/java/org/tests/compositekeys/TestCore.java index 35192da768..3219072b48 100644 --- a/ebean-test/src/test/java/org/tests/compositekeys/TestCore.java +++ b/ebean-test/src/test/java/org/tests/compositekeys/TestCore.java @@ -142,7 +142,7 @@ public void testDoubleLazyLoad() { @Test public void testEmbeddedWithOrder() { - List items = server().find(Item.class).order("auditInfo.created asc, type asc").findList(); + List items = server().find(Item.class).orderBy("auditInfo.created asc, type asc").findList(); assertNotNull(items); assertEquals(2, items.size()); @@ -151,7 +151,7 @@ public void testEmbeddedWithOrder() { @Test public void testFindAndOrderByEType() { - List items = server().find(Item.class).order("eType").findList(); + List items = server().find(Item.class).orderBy("eType").findList(); assertNotNull(items); assertEquals(2, items.size()); diff --git a/ebean-test/src/test/java/org/tests/draftable/LinkQueryPublishTest.java b/ebean-test/src/test/java/org/tests/draftable/LinkQueryPublishTest.java index 13540041c9..0845bbbb9c 100644 --- a/ebean-test/src/test/java/org/tests/draftable/LinkQueryPublishTest.java +++ b/ebean-test/src/test/java/org/tests/draftable/LinkQueryPublishTest.java @@ -45,7 +45,7 @@ public void testPublishViaQuery() { Query pubQuery = server.find(Link.class) .where().idIn(ids) - .order().asc("id"); + .orderBy().asc("id"); List pubList = server.publish(pubQuery); diff --git a/ebean-test/src/test/java/org/tests/expression/bitwise/TestBitwiseExpressions.java b/ebean-test/src/test/java/org/tests/expression/bitwise/TestBitwiseExpressions.java index 5a269dec8b..6c8475fc07 100644 --- a/ebean-test/src/test/java/org/tests/expression/bitwise/TestBitwiseExpressions.java +++ b/ebean-test/src/test/java/org/tests/expression/bitwise/TestBitwiseExpressions.java @@ -55,7 +55,7 @@ void bitwiseAnd() { void bitwiseAny() { List list = DB.find(BwBean.class) .where().bitwiseAny("flags", BwFlags.HAS_BULK + BwFlags.HAS_SIZE) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(3); @@ -65,21 +65,21 @@ void bitwiseAny() { list = DB.find(BwBean.class) .where().bitwiseAny("flags", BwFlags.HAS_BULK + BwFlags.HAS_SIZE + BwFlags.HAS_COLOUR) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(4); list = DB.find(BwBean.class) .where().bitwiseAny("flags", BwFlags.HAS_SIZE + BwFlags.HAS_COLOUR) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(4); list = DB.find(BwBean.class) .where().bitwiseAny("flags", BwFlags.HAS_SIZE) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(2); @@ -88,7 +88,7 @@ void bitwiseAny() { list = DB.find(BwBean.class) .where().bitwiseAny("flags", BwFlags.HAS_COLOUR) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(3); @@ -108,7 +108,7 @@ void bitwiseAll() { list = DB.find(BwBean.class) .where().bitwiseAll("flags", BwFlags.HAS_BULK + BwFlags.HAS_COLOUR) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(2); @@ -117,7 +117,7 @@ void bitwiseAll() { list = DB.find(BwBean.class) .where().bitwiseAll("flags", BwFlags.HAS_SIZE) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(2); @@ -126,7 +126,7 @@ void bitwiseAll() { list = DB.find(BwBean.class) .where().bitwiseAll("flags", BwFlags.HAS_COLOUR) - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(list).hasSize(3); diff --git a/ebean-test/src/test/java/org/tests/inheritance/TestInheritanceBatchLazyLoad.java b/ebean-test/src/test/java/org/tests/inheritance/TestInheritanceBatchLazyLoad.java index 0f72ec0e69..425eb1fcfb 100644 --- a/ebean-test/src/test/java/org/tests/inheritance/TestInheritanceBatchLazyLoad.java +++ b/ebean-test/src/test/java/org/tests/inheritance/TestInheritanceBatchLazyLoad.java @@ -30,7 +30,7 @@ public void lazyLoadProperty_when_propertyNotOnAllInheritanceTypes() { List list = DB.find(Vehicle.class) .select("licenseNumber") .where().startsWith("licenseNumber", "VZVZ") - .order().asc("licenseNumber") + .orderBy().asc("licenseNumber") .findList(); assertThat(list).hasSize(2); diff --git a/ebean-test/src/test/java/org/tests/inheritance/bothsides/TestInheritanceBothSides.java b/ebean-test/src/test/java/org/tests/inheritance/bothsides/TestInheritanceBothSides.java index 80a8910a76..dce7f02d51 100644 --- a/ebean-test/src/test/java/org/tests/inheritance/bothsides/TestInheritanceBothSides.java +++ b/ebean-test/src/test/java/org/tests/inheritance/bothsides/TestInheritanceBothSides.java @@ -18,7 +18,7 @@ public class TestInheritanceBothSides extends BaseTestCase { @Test public void selectSourceBaseSql() { - final Query query = DB.find(SourceBase.class).order("pos"); + final Query query = DB.find(SourceBase.class).orderBy("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 void selectSourceBaseSql() { @Test public void selectSourceASql() { - final Query query = DB.find(SourceA.class).order("pos"); + final Query query = DB.find(SourceA.class).orderBy("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 void selectSourceASql() { @Test public void selectSourceAWithJoin() { - final Query query = DB.find(SourceA.class).fetch("target", "name").order("pos"); + final Query query = DB.find(SourceA.class).fetch("target", "name").orderBy("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 and t1.dtype = 'Target1' where t0.dtype = 'SourceA' order by t0.pos"); @@ -78,7 +78,7 @@ private void assertFetchAllSourceAs() { final List sourceAList = DB.find(SourceA.class) .fetch("target", "name") - .order("pos") + .orderBy("pos") .findList(); final String joinedNames = sourceAList.stream() @@ -99,7 +99,7 @@ private void assertFetchAllDoubleLazyLoading() { LoggedSql.start(); - final List sources = DB.find(SourceBase.class).order("pos").findList(); + final List sources = DB.find(SourceBase.class).orderBy("pos").findList(); for (SourceBase source : sources) { if (source instanceof SourceA) { SourceA a = (SourceA) source; diff --git a/ebean-test/src/test/java/org/tests/level/test/ManyToManyTest.java b/ebean-test/src/test/java/org/tests/level/test/ManyToManyTest.java index 34a71b8994..a3bf3ab834 100644 --- a/ebean-test/src/test/java/org/tests/level/test/ManyToManyTest.java +++ b/ebean-test/src/test/java/org/tests/level/test/ManyToManyTest.java @@ -69,7 +69,7 @@ public void test() { .fetch("level4s") .fetch("level2s") .fetch("level2s.level3s") - .order().asc("id") + .orderBy().asc("id") .findList(); validateObjectGraph(i, ii, iii, one, two, x1, x2, x3, x4, x5, things); @@ -79,7 +79,7 @@ public void test() { .fetch("level2s") .fetch("level2s.level3s") .fetch("level4s") - .order().asc("id") + .orderBy().asc("id") .findList(); validateObjectGraph(i, ii, iii, one, two, x1, x2, x3, x4, x5, things); @@ -88,7 +88,7 @@ public void test() { things = DB.find(Level1.class) .fetch("level2s") .fetch("level4s") - .order().asc("id") + .orderBy().asc("id") .findList(); validateObjectGraph(i, ii, iii, one, two, x1, x2, x3, x4, x5, things); diff --git a/ebean-test/src/test/java/org/tests/m2m/TestM2MDistinct_sqlServer.java b/ebean-test/src/test/java/org/tests/m2m/TestM2MDistinct_sqlServer.java index 327aa8e87f..beed1367b7 100644 --- a/ebean-test/src/test/java/org/tests/m2m/TestM2MDistinct_sqlServer.java +++ b/ebean-test/src/test/java/org/tests/m2m/TestM2MDistinct_sqlServer.java @@ -24,7 +24,7 @@ public void testName() { LoggedSql.start(); List roles = DB.find(Role.class).where().eq("permissions", perm) - .order().asc("name", "Latin1_General_CI_AS") + .orderBy().asc("name", "Latin1_General_CI_AS") .findList(); List sqls = LoggedSql.stop(); diff --git a/ebean-test/src/test/java/org/tests/m2m/softdelete/TestM2MSoftDeleteExists.java b/ebean-test/src/test/java/org/tests/m2m/softdelete/TestM2MSoftDeleteExists.java index 7f681b81b3..879b6dc273 100644 --- a/ebean-test/src/test/java/org/tests/m2m/softdelete/TestM2MSoftDeleteExists.java +++ b/ebean-test/src/test/java/org/tests/m2m/softdelete/TestM2MSoftDeleteExists.java @@ -23,7 +23,7 @@ public void test() { Query query = DB.find(MsManyA.class) .where().isNotEmpty("manybs") - .order("aid").query(); + .orderBy("aid").query(); List list = query.findList(); @@ -45,7 +45,7 @@ private void testDeletedB0() { List list = DB.find(MsManyA.class) .where().isNotEmpty("manybs") - .order("aid") + .orderBy("aid") .findList(); assertThat(list).hasSize(2); @@ -61,7 +61,7 @@ private void testDeletedB1() { List list = DB.find(MsManyA.class) .where().isNotEmpty("manybs") - .order("aid") + .orderBy("aid") .findList(); assertThat(list).hasSize(1); diff --git a/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java b/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java index b3fa88307c..227676eebe 100644 --- a/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java +++ b/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java @@ -103,7 +103,7 @@ public void findList_inClause_someHits() { .eq("store", storeId) .in("sku", skus) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); List sql = LoggedSql.collect(); @@ -122,7 +122,7 @@ public void findList_inClause_someHits() { .eq("store", storeId) .in("sku", skus) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); sql = LoggedSql.collect(); @@ -141,7 +141,7 @@ public void findList_inClause_someHits() { .eq("store", storeId) .in("sku", skus) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); sql = LoggedSql.stop(); @@ -171,7 +171,7 @@ public void findList_inClause_allHits() { .eq("store", storeId) .in("sku", skus) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); List sql = LoggedSql.stop(); @@ -200,7 +200,7 @@ public void findList_inClause_noHits() { .eq("store", storeId) .in("sku", skus) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); List sql = LoggedSql.stop(); diff --git a/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java b/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java index 8cf5617f1b..f83ce11458 100644 --- a/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java +++ b/ebean-test/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java @@ -113,7 +113,7 @@ public void findMap_inClause_allHits() { .eq("sku", "2") .in("code", codes) .setUseCache(true) - .order().asc("code") + .orderBy().asc("code") .setMapKey("sku") .findMap(); @@ -142,7 +142,7 @@ public void findMap_inClause_someHits() { .eq("sku", "2") .in("code", codes) .setUseCache(true) - .order().asc("code") + .orderBy().asc("code") .setMapKey("sku") .findMap(); @@ -203,8 +203,8 @@ public void findList_inClause_someHits() { .in("code", codes) .eq("sku", "2") .setUseCache(true) - .order().desc("sku") - .order().asc("code") + .orderBy().desc("sku") + .orderBy().asc("code") .findList(); List sql = LoggedSql.stop(); @@ -236,7 +236,7 @@ public void findList_inClause_allHits() { .in("sku", skus) .eq("code", 1001) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); List sql = LoggedSql.stop(); @@ -266,7 +266,7 @@ public void findList_inClause_noHits() { .in("sku", skus) .eq("code", 1001) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); List sql = LoggedSql.stop(); @@ -361,7 +361,7 @@ public void findList_inPairs_standardConcat() { .eq("store", "def") .inPairs(pairs) .setUseCache(true) - .order("sku desc") + .orderBy("sku desc") .findList(); List sql = LoggedSql.stop(); @@ -404,7 +404,7 @@ public void findList_inPairs_userConcat() { .eq("store", "def") .inPairs(pairs) .setBeanCacheMode(CacheMode.ON) - .order("sku desc") + .orderBy("sku desc") .findList(); List sql = LoggedSql.stop(); diff --git a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasic.java b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasic.java index 1d8b1623ad..cb8b98020d 100644 --- a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasic.java +++ b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasic.java @@ -90,7 +90,7 @@ void test() { List found = DB.find(EcPerson.class).where() .startsWith("name", "Fiona0") - .order().asc("id") + .orderBy().asc("id") .findList(); List phoneNumbers0 = found.get(0).getPhoneNumbers(); @@ -110,7 +110,7 @@ void test() { .fetch("phoneNumbers") .where() .startsWith("name", "Fiona0") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(found2).hasSize(2); diff --git a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicMap.java b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicMap.java index 881f8a737f..69122cebd8 100644 --- a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicMap.java +++ b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicMap.java @@ -48,7 +48,7 @@ public void test() { List found = DB.find(EcmPerson.class).where() .startsWith("name", "MFiona0") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(found).hasSize(2); @@ -72,7 +72,7 @@ public void test() { .fetch("phoneNumbers") .where() .startsWith("name", "MFiona0") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(found2).hasSize(2); diff --git a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicSet.java b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicSet.java index cec750a084..7ba2632095 100644 --- a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicSet.java +++ b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionBasicSet.java @@ -45,7 +45,7 @@ void test() { List found = DB.find(EcsPerson.class).where() .startsWith("name", "Fiona0") - .order().asc("id") + .orderBy().asc("id") .findList(); Set phoneNumbers0 = found.get(0).getPhoneNumbers(); @@ -67,7 +67,7 @@ void test() { .fetch("phoneNumbers") .where() .startsWith("name", "Fiona0") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(found2).hasSize(2); diff --git a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedList.java b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedList.java index 29c03adc97..7951d63a12 100644 --- a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedList.java +++ b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedList.java @@ -44,7 +44,7 @@ public void test() { List found = DB.find(EcblPerson.class).where() .startsWith("name", "Fiona640") - .order().asc("id") + .orderBy().asc("id") .findList(); List phoneNumbers0 = found.get(0).getPhoneNumbers(); @@ -64,7 +64,7 @@ public void test() { .fetch("phoneNumbers") .where() .startsWith("name", "Fiona640") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(found2).hasSize(2); diff --git a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedMap.java b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedMap.java index 95f4bfaeeb..9e56bdf0c7 100644 --- a/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedMap.java +++ b/ebean-test/src/test/java/org/tests/model/elementcollection/TestElementCollectionEmbeddedMap.java @@ -47,7 +47,7 @@ public void test() { List found = DB.find(EcbmPerson.class).where() .startsWith("name", "Fiona640") - .order().asc("id") + .orderBy().asc("id") .findList(); Map phoneNumbers0 = found.get(0).getPhoneNumbers(); @@ -62,7 +62,7 @@ public void test() { .fetch("phoneNumbers") .where() .startsWith("name", "Fiona640") - .order().asc("id") + .orderBy().asc("id") .findList(); assertThat(found2).hasSize(2); diff --git a/ebean-test/src/test/java/org/tests/model/pview/TestPview.java b/ebean-test/src/test/java/org/tests/model/pview/TestPview.java index 0bddc3e798..9456dd4fd8 100644 --- a/ebean-test/src/test/java/org/tests/model/pview/TestPview.java +++ b/ebean-test/src/test/java/org/tests/model/pview/TestPview.java @@ -19,7 +19,7 @@ public void test() { Query query = DB.find(Paggview.class); query.select("amount"); query.where().eq("pview.wviews", wview); - query.order("pview.value"); + query.orderBy("pview.value"); query.findList(); String generatedSql = sqlOf(query, 1); diff --git a/ebean-test/src/test/java/org/tests/model/selfref/TestSelfRefExample.java b/ebean-test/src/test/java/org/tests/model/selfref/TestSelfRefExample.java index 1ed17e9234..b5d3154637 100644 --- a/ebean-test/src/test/java/org/tests/model/selfref/TestSelfRefExample.java +++ b/ebean-test/src/test/java/org/tests/model/selfref/TestSelfRefExample.java @@ -42,7 +42,7 @@ public void test() { DB.save(e8); Query examples = DB.find(SelfRefExample.class).setLazyLoadBatchSize(1); - List list = examples.where().eq("name", "test1").order().asc("id").findList(); + List list = examples.where().eq("name", "test1").orderBy().asc("id").findList(); assertThat(list).hasSize(2); @@ -66,7 +66,7 @@ public void test() { 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 examples2 = DB.createQuery(SelfRefExample.class).order("id asc"); + Query examples2 = DB.createQuery(SelfRefExample.class).orderBy("id asc"); List list2 = examples2.findList(); assertEquals(e1.getId(), list2.get(0).getId()); diff --git a/ebean-test/src/test/java/org/tests/model/selfref/TestTextJsonSelfRef.java b/ebean-test/src/test/java/org/tests/model/selfref/TestTextJsonSelfRef.java index 6ca62e534c..cc17019dfa 100644 --- a/ebean-test/src/test/java/org/tests/model/selfref/TestTextJsonSelfRef.java +++ b/ebean-test/src/test/java/org/tests/model/selfref/TestTextJsonSelfRef.java @@ -35,7 +35,7 @@ public void test() { } }); - List customers = DB.find(SelfRefCustomer.class).order("id desc").findList(); + List customers = DB.find(SelfRefCustomer.class).orderBy("id desc").findList(); // Check that there are no 'reference' beans here for (SelfRefCustomer cust : customers) { diff --git a/ebean-test/src/test/java/org/tests/persistencecontext/TestPersistenceContextScopeUsingOrders.java b/ebean-test/src/test/java/org/tests/persistencecontext/TestPersistenceContextScopeUsingOrders.java index 3ea926b291..90cb627db9 100644 --- a/ebean-test/src/test/java/org/tests/persistencecontext/TestPersistenceContextScopeUsingOrders.java +++ b/ebean-test/src/test/java/org/tests/persistencecontext/TestPersistenceContextScopeUsingOrders.java @@ -28,7 +28,7 @@ public void test_persistenceContextScopeQuery() { .setPersistenceContextScope(QUERY) .fetch("customer", "id, name") .where().istartsWith("customer.name", "rob").eq("customer.id", 1) - .order().asc("customer.name") + .orderBy().asc("customer.name") .findList(); assertTrue(!orders.isEmpty()); diff --git a/ebean-test/src/test/java/org/tests/query/TestAddOrderByWithFirstRowsMaxRows.java b/ebean-test/src/test/java/org/tests/query/TestAddOrderByWithFirstRowsMaxRows.java index 1f88000627..e2e74e9385 100644 --- a/ebean-test/src/test/java/org/tests/query/TestAddOrderByWithFirstRowsMaxRows.java +++ b/ebean-test/src/test/java/org/tests/query/TestAddOrderByWithFirstRowsMaxRows.java @@ -29,7 +29,7 @@ public void test_firstRows() { DB.find(Order.class) .setFirstRow(3) - .order().asc("id") + .orderBy().asc("id") .findList(); List loggedSql = LoggedSql.stop(); @@ -69,7 +69,7 @@ public void test_firstRowsMaxRows() { DB.find(Order.class) .setFirstRow(3) .setMaxRows(10) - .order().asc("id") + .orderBy().asc("id") .findList(); List loggedSql = LoggedSql.stop(); @@ -129,7 +129,7 @@ public void test_pagingTwo() { DB.find(Order.class) .setFirstRow(10) .setMaxRows(10) - .order("id") + .orderBy("id") .findPagedList() .getList(); @@ -150,7 +150,7 @@ public void test_pagingAppendToExistingOrderBy() { LoggedSql.start(); DB.find(Order.class) - .order().asc("orderDate") + .orderBy().asc("orderDate") .setMaxRows(10) .findPagedList() .getList(); @@ -169,8 +169,8 @@ public void test_pagingExistingOrderByWithId() { LoggedSql.start(); DB.find(Order.class) - .order().asc("orderDate") - .order().desc("id") + .orderBy().asc("orderDate") + .orderBy().desc("id") .setMaxRows(10) .findPagedList() .getList(); diff --git a/ebean-test/src/test/java/org/tests/query/TestExprNestedDisjunction.java b/ebean-test/src/test/java/org/tests/query/TestExprNestedDisjunction.java index aa8830f25d..1502d935f2 100644 --- a/ebean-test/src/test/java/org/tests/query/TestExprNestedDisjunction.java +++ b/ebean-test/src/test/java/org/tests/query/TestExprNestedDisjunction.java @@ -22,7 +22,7 @@ public void test() { .disjunction() .conjunction().startsWith("name", "r").eq("anniversary", onAfter).endJunction() .conjunction().eq("status", Customer.Status.ACTIVE).gt("id", 0).endJunction() - .order().asc("name"); + .orderBy().asc("name"); q.findList(); String s = q.getGeneratedSql(); @@ -46,7 +46,7 @@ public void test_nested_and() { .startsWith("name", "r").eq("anniversary", onAfter).endAnd() .and() .eq("status", Customer.Status.ACTIVE).gt("id", 0).endAnd() - .order().asc("name"); + .orderBy().asc("name"); q.findList(); String s = q.getGeneratedSql(); @@ -68,7 +68,7 @@ public void test_not() { .gt("id", 1) .eq("anniversary", onAfter) .endNot() - .order().asc("name"); + .orderBy().asc("name"); q.findList(); String s = q.getGeneratedSql(); @@ -90,7 +90,7 @@ public void test_not_nested() { .not() .gt("id", 1) .eq("anniversary", onAfter) - .order().asc("name"); + .orderBy().asc("name"); q.findList(); String s = q.getGeneratedSql(); @@ -114,7 +114,7 @@ public void test_not_nested_with_endNot() { .eq("anniversary", onAfter) .endNot() .endOr() - .order().asc("name"); + .orderBy().asc("name"); q.findList(); String s = q.getGeneratedSql(); diff --git a/ebean-test/src/test/java/org/tests/query/TestLimitAlterFetchMany.java b/ebean-test/src/test/java/org/tests/query/TestLimitAlterFetchMany.java index d2979f723c..0c6c5dfc14 100644 --- a/ebean-test/src/test/java/org/tests/query/TestLimitAlterFetchMany.java +++ b/ebean-test/src/test/java/org/tests/query/TestLimitAlterFetchMany.java @@ -24,7 +24,7 @@ public void test() { Query query = DB.find(Customer.class) // this will automatically get converted to a // query join ... due to the maxRows - .fetch("contacts").setMaxRows(5).order("id"); + .fetch("contacts").setMaxRows(5).orderBy("id"); List list = query.findList(); diff --git a/ebean-test/src/test/java/org/tests/query/TestManyWhereJoin.java b/ebean-test/src/test/java/org/tests/query/TestManyWhereJoin.java index 2f4701ddd4..3ae6bfdfb7 100644 --- a/ebean-test/src/test/java/org/tests/query/TestManyWhereJoin.java +++ b/ebean-test/src/test/java/org/tests/query/TestManyWhereJoin.java @@ -89,7 +89,7 @@ public void testUsingForeignKey() { Query query = DB.find(Order.class) .where().eq("details.product.id", productId) - .order("cretime asc").query(); + .orderBy("cretime asc").query(); query.findList(); String sql = sqlOf(query, 3); @@ -123,7 +123,7 @@ public void testUsingForeignKeyReferenceBean() { Query query = DB.find(Order.class) //.fetch("details") .where().eq("details.product", product) - .order("cretime asc").query(); + .orderBy("cretime asc").query(); query.findList(); String sql = sqlOf(query, 3); @@ -157,7 +157,7 @@ public void testUsingForeignKeyAndFetch() { Query query = DB.find(Order.class) .fetch("details") .where().eq("details.product", product) - .order("cretime asc").query(); + .orderBy("cretime asc").query(); query.findList(); String sql = sqlOf(query, 3); diff --git a/ebean-test/src/test/java/org/tests/query/TestOuterJoin.java b/ebean-test/src/test/java/org/tests/query/TestOuterJoin.java index f75b426bc6..95b931255d 100644 --- a/ebean-test/src/test/java/org/tests/query/TestOuterJoin.java +++ b/ebean-test/src/test/java/org/tests/query/TestOuterJoin.java @@ -154,7 +154,7 @@ public void testOuterOnFetch() { LoggedSql.start(); - List orders1 = DB.find(Order.class).order("id").findList(); + List orders1 = DB.find(Order.class).orderBy("id").findList(); assertThat(LoggedSql.collect().get(0)) .contains(" join o_customer") // ensure that we do not left join the customer @@ -165,7 +165,7 @@ public void testOuterOnFetch() { LoggedSql.start(); List orders2 = DB.find(Order.class) - .fetch("details", "id").order("id").findList(); + .fetch("details", "id").orderBy("id").findList(); assertThat(LoggedSql.collect().get(0)) .contains(" left join o_order_detail "); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryFetchJoinWithOrder.java b/ebean-test/src/test/java/org/tests/query/TestQueryFetchJoinWithOrder.java index 7df6843c79..f2aa876571 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryFetchJoinWithOrder.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryFetchJoinWithOrder.java @@ -20,16 +20,16 @@ public void test() { List list = DB.find(Order.class) .fetchQuery("details") - .order().asc("id") - .order().desc("details.id").findList(); + .orderBy().asc("id") + .orderBy().desc("details.id").findList(); assertNotNull(list); List list2 = DB.find(Order.class) .fetchQuery("customer") .fetch("customer.contacts") - .order().asc("id") - .order().asc("customer.contacts.lastName") + .orderBy().asc("id") + .orderBy().asc("customer.contacts.lastName") .findList(); assertNotNull(list2); @@ -37,7 +37,7 @@ public void test() { List list3 = DB.find(Customer.class) .fetch("orders") .filterMany("orders").eq("status", Order.Status.NEW) - .order().desc("orders.id") + .orderBy().desc("orders.id") .findList(); assertNotNull(list3); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java b/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java index 87af06b4b6..c5846aa9cc 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java @@ -30,7 +30,7 @@ public void test() { .fetchLazy("orders") .filterMany("orders").eq("status", Order.Status.NEW) .where().ieq("name", "Rob") - .order().asc("id").setMaxRows(1) + .orderBy().asc("id").setMaxRows(1) .findList().get(0); final int size = customer.getOrders().size(); @@ -55,8 +55,8 @@ public void filterMany_firstMaxRows_fluidStyle() { final Query query = DB.find(Customer.class) .where().ieq("name", "Rob") // fluid style adding maxRows/firstRow to filterMany - .filterMany("orders").eq("status", Order.Status.NEW).order("id desc").setMaxRows(100).setFirstRow(3) - .order().asc("id").setMaxRows(5); + .filterMany("orders").eq("status", Order.Status.NEW).orderBy("id desc").setMaxRows(100).setFirstRow(3) + .orderBy().asc("id").setMaxRows(5); final List customers = query.findList(); assertThat(customers).isNotEmpty(); @@ -82,10 +82,10 @@ public void test_firstMaxRows() { final Query query = DB.find(Customer.class) .where().ieq("name", "Rob") - .order().asc("id").setMaxRows(5); + .orderBy().asc("id").setMaxRows(5); // non-fluid style adding maxRows/firstRow - final ExpressionList filterMany = query.filterMany("orders").order("id desc").eq("status", Order.Status.NEW); + final ExpressionList filterMany = query.filterMany("orders").orderBy("id desc").eq("status", Order.Status.NEW); filterMany.setMaxRows(100); filterMany.setFirstRow(3); @@ -116,8 +116,8 @@ public void filterMany_firstMaxRows_expressionFluidStyle() { .where().ieq("name", "Rob") // use expression + fluid style adding maxRows/firstRow to filterMany .filterMany("orders", "status = ?", Order.Status.NEW) - .setMaxRows(100).setFirstRow(3).order("orderDate desc, id") - .order().asc("id").setMaxRows(5); + .setMaxRows(100).setFirstRow(3).orderBy("orderDate desc, id") + .orderBy().asc("id").setMaxRows(5); final List customers = query.findList(); assertThat(customers).isNotEmpty(); @@ -143,8 +143,8 @@ public void filterManyRaw_firstMaxRows_expressionFluidStyle() { .where().ieq("name", "Rob") // use expression + fluid style adding maxRows/firstRow to filterMany .filterManyRaw("orders", "status = ?", Order.Status.NEW) - .setMaxRows(100).setFirstRow(3).order("orderDate desc, id") - .order().asc("id").setMaxRows(5); + .setMaxRows(100).setFirstRow(3).orderBy("orderDate desc, id") + .orderBy().asc("id").setMaxRows(5); final List customers = query.findList(); assertThat(customers).isNotEmpty(); @@ -169,7 +169,7 @@ public void filterManyRaw_singleQuery() { final Query query = DB.find(Customer.class) .where().ieq("name", "Rob") .filterManyRaw("orders", "status = ?", Order.Status.NEW) - .order().asc("id"); + .orderBy().asc("id"); final List customers = query.findList(); assertThat(customers).isNotEmpty(); @@ -185,7 +185,7 @@ public void test_with_findOne_rawSeparateQuery() { LoggedSql.start(); Customer customer = DB.find(Customer.class) .setMaxRows(1) - .order().asc("id") + .orderBy().asc("id") .fetch("orders") .filterMany("orders").raw("orderDate is not null") .findOne(); @@ -203,7 +203,7 @@ public void test_with_findOne_rawSameQuery() { LoggedSql.start(); var result = DB.find(Customer.class) - .order().asc("id") + .orderBy().asc("id") .fetch("orders") .filterMany("orders").raw("orderDate is not null") .findList(); @@ -222,7 +222,7 @@ public void test_with_findOneOrEmpty() { Optional customer = DB.find(Customer.class) .setMaxRows(1) - .order().asc("id") + .orderBy().asc("id") .fetch("orders") .filterMany("orders").raw("1 = 0") .findOneOrEmpty(); @@ -262,7 +262,7 @@ public void test_filterMany_in_findCount() { Query query = DB.find(Customer.class) .fetch("orders") .filterMany("orders").in("status", Order.Status.NEW) - .order().asc("id"); + .orderBy().asc("id"); query.findCount(); @@ -281,7 +281,7 @@ public void test_filterMany_copy_findList() { Query query = DB.find(Customer.class) .fetch("orders") .filterMany("orders").in("status", Order.Status.NEW) - .order().asc("id"); + .orderBy().asc("id"); query.copy().findList(); @@ -304,7 +304,7 @@ public void test_filterMany_fetchQuery() { Query query = DB.find(Customer.class) .fetchQuery("orders") // explicitly fetch orders separately .filterMany("orders").in("status", Order.Status.NEW) - .order().asc("id"); + .orderBy().asc("id"); query.findList(); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryFindEach.java b/ebean-test/src/test/java/org/tests/query/TestQueryFindEach.java index ee63a1818d..99dacfc7ab 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryFindEach.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryFindEach.java @@ -39,7 +39,7 @@ public void test() { Query query = DB.find(Customer.class) .fetchQuery("contacts") - .where().gt("id", 0).order("id") + .where().gt("id", 0).orderBy("id") .setMaxRows(2).query(); final AtomicInteger counter = new AtomicInteger(0); @@ -146,7 +146,7 @@ public void testVisitThrowingException() { Query query = DB.find(Customer.class) .fetchQuery("contacts") - .where().gt("id", 0).order("id") + .where().gt("id", 0).orderBy("id") .setMaxRows(2).query(); final AtomicInteger counter = new AtomicInteger(0); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryFindEachWhile.java b/ebean-test/src/test/java/org/tests/query/TestQueryFindEachWhile.java index 416da96115..9b55104ad1 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryFindEachWhile.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryFindEachWhile.java @@ -21,7 +21,7 @@ public void test() { Query query = DB.find(Customer.class) .setAutoTune(false) - .fetchQuery("contacts").where().gt("id", 0).order("id") + .fetchQuery("contacts").where().gt("id", 0).orderBy("id") .setMaxRows(2).query(); final AtomicInteger counter = new AtomicInteger(0); @@ -43,7 +43,7 @@ public void testVisitThrowingException() { ResetBasicData.reset(); Query query = DB.find(Customer.class).setAutoTune(false) - .fetchQuery("contacts").where().gt("id", 0).order("id") + .fetchQuery("contacts").where().gt("id", 0).orderBy("id") .setMaxRows(2).query(); final AtomicInteger counter = new AtomicInteger(0); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryFindIterate.java b/ebean-test/src/test/java/org/tests/query/TestQueryFindIterate.java index ee6c51ac40..817f783aaf 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryFindIterate.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryFindIterate.java @@ -54,7 +54,7 @@ public void test_hasNext_hasNext() { .where() .isNotNull("name") .setMaxRows(3) - .order().asc("id") + .orderBy().asc("id") .findIterate(); try { @@ -161,7 +161,7 @@ public void testWithTwoJoins() { .fetch("customer", "name") .fetch("details") .where().gt("id", 0).le("id", 10) - .order().asc("id") + .orderBy().asc("id") .findEach(order -> { Customer customer = order.getCustomer(); order.getId(); @@ -233,7 +233,7 @@ public void findIterateCloseConnection(boolean withLoadBatch) { .where() .isNotNull("name") .setMaxRows(3) - .order().asc("id"); + .orderBy().asc("id"); if (withLoadBatch) { query.setLazyLoadBatchSize(1); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryFindPagedList.java b/ebean-test/src/test/java/org/tests/query/TestQueryFindPagedList.java index 4a78a5a41b..459328877b 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryFindPagedList.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryFindPagedList.java @@ -108,7 +108,7 @@ public void test_maxRows_countInBackground_withLoadRowCount() { PagedList pagedList2 = DB.find(Order.class) .setFirstRow(1) .setMaxRows(3) - .order("id") + .orderBy("id") .findPagedList(); pagedList2.loadCount(); @@ -124,7 +124,7 @@ public void test_maxRows_countInBackground_withLoadRowCount() { PagedList pagedList3 = DB.find(Order.class) .setFirstRow(2) .setMaxRows(150) - .order("id") + .orderBy("id") .findPagedList(); assertFalse(pagedList3.hasNext()); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryOrderById.java b/ebean-test/src/test/java/org/tests/query/TestQueryOrderById.java index fb7c002d6c..ca9a87b33b 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryOrderById.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryOrderById.java @@ -23,7 +23,7 @@ public void orderById_default_expectNotOrderById() { Query query = DB.find(Customer.class) .select("id,name") - .order("id") + .orderBy("id") .setFirstRow(1) .setMaxRows(5); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryPathJoinAndOrder.java b/ebean-test/src/test/java/org/tests/query/TestQueryPathJoinAndOrder.java index b7910ee4fe..a9229bcd5e 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryPathJoinAndOrder.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryPathJoinAndOrder.java @@ -18,7 +18,7 @@ public void test() { ResetBasicData.reset(); List list = DB.find(Customer.class).select("id,name, status").fetch("contacts") - .order().asc("id").order().desc("contacts.firstName").setMaxRows(3).findList(); + .orderBy().asc("id").orderBy().desc("contacts.firstName").setMaxRows(3).findList(); assertNotNull(list); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryPlanCacheRowCount.java b/ebean-test/src/test/java/org/tests/query/TestQueryPlanCacheRowCount.java index 16feef8be6..a1a4092bec 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryPlanCacheRowCount.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryPlanCacheRowCount.java @@ -20,7 +20,7 @@ public void test() { ResetBasicData.reset(); Query query = DB.find(Order.class).where().eq("status", Order.Status.NEW).ge("id", 1) - .order().desc("id"); + .orderBy().desc("id"); int rc0 = query.findCount(); @@ -47,7 +47,7 @@ public void test() { // should still hit query plan cache Query query2 = DB.find(Order.class).where().eq("status", Order.Status.NEW) - .ge("id", idGt).order().desc("id"); + .ge("id", idGt).orderBy().desc("id"); int rc2 = query2.findCount(); diff --git a/ebean-test/src/test/java/org/tests/query/TestRowCount.java b/ebean-test/src/test/java/org/tests/query/TestRowCount.java index b65ce9591a..74ab27936e 100644 --- a/ebean-test/src/test/java/org/tests/query/TestRowCount.java +++ b/ebean-test/src/test/java/org/tests/query/TestRowCount.java @@ -26,7 +26,7 @@ public void test() { .where() .gt("id", 1) .gt("details.id", 1) - .order("id desc").query(); + .orderBy("id desc").query(); int rc = query.findCount(); List ids = query.findIds(); diff --git a/ebean-test/src/test/java/org/tests/query/aggregation/TestAggregationCount.java b/ebean-test/src/test/java/org/tests/query/aggregation/TestAggregationCount.java index 7d2bc67791..f4e2bc8edc 100644 --- a/ebean-test/src/test/java/org/tests/query/aggregation/TestAggregationCount.java +++ b/ebean-test/src/test/java/org/tests/query/aggregation/TestAggregationCount.java @@ -117,7 +117,7 @@ public void testFull() { .startsWith("logs.description", "a") .having() .ge("count", 1) - .order().asc("name"); + .orderBy().asc("name"); List list = query2.findList(); for (TEventOne eventOne : list) { @@ -142,7 +142,7 @@ public void testOrderByTotal() { Query query = DB.find(TEventOne.class) .select("name, count, totalUnits, totalAmount") - .order().asc("totalUnits").order().asc("name"); + .orderBy().asc("totalUnits").orderBy().asc("name"); List list = query.findList(); assertThat(list).isNotEmpty(); @@ -201,7 +201,7 @@ public void testSelectHavingOrderBy() { Query query1 = DB.find(TEventOne.class) .select("name, count, totalUnits, totalAmount") .having().ge("count", 1) - .order().asc("name"); + .orderBy().asc("name"); query1.findList(); assertThat(query1.getGeneratedSql()).contains("having count(u1.id) >= ? order by t0.name"); @@ -420,7 +420,7 @@ public void example_nonAggregateFormula() { DB.find(Contact.class) .select(concat("lastName",", ","firstName")) .where().isNull("phone") - .order().asc("lastName") + .orderBy().asc("lastName") .findSingleAttributeList(); assertThat(names).isNotEmpty(); @@ -441,7 +441,7 @@ public void concat_expectString() { DB.find(Contact.class) .select(concat("updtime",", ","firstName")+"::String") .where().isNull("phone") - .order().asc("lastName") + .orderBy().asc("lastName") .findSingleAttributeList(); assertThat(names).isNotEmpty(); @@ -483,7 +483,7 @@ public void formula_mapToProperty() { DB.find(Contact.class) .select("email, " + concat("lastName",", ","firstName") + " as lastName") .where().isNull("phone") - .order().asc("lastName") + .orderBy().asc("lastName") .findList(); assertThat(contacts).isNotEmpty(); diff --git a/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java b/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java index 15b50226e9..e757bbce55 100644 --- a/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java +++ b/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java @@ -79,7 +79,7 @@ public void testOrderOnChainedFormulaProperty() { // Tests if SqlTreeBuilder.IncludesDistiller.createExtraJoin appends formulaJoinProperties Query shipQuery = DB.find(OrderShipment.class) .select("id") - .order().asc("order.totalAmount"); + .orderBy().asc("order.totalAmount"); shipQuery.findList(); assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id " @@ -137,7 +137,7 @@ public void testOrderOnChainedFormulaPropertyWithFetch() { Query shipQuery = DB.find(OrderShipment.class) .select("id") .fetch("order", "totalAmount") - .order().asc("order.totalAmount"); + .orderBy().asc("order.totalAmount"); shipQuery.findList(); assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id, t1.id, z_bt1.total_amount " diff --git a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByClear.java b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByClear.java index 061e0da9f3..2bd0834e62 100644 --- a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByClear.java +++ b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByClear.java @@ -20,10 +20,10 @@ public void test() { ResetBasicData.reset(); Query query = DB.find(Order.class) - .order().asc("orderDate"); + .orderBy().asc("orderDate"); - OrderBy orderBy = query.order(); + OrderBy orderBy = query.orderBy(); assertTrue(orderBy.containsProperty("orderDate")); orderBy.clear(); @@ -38,7 +38,7 @@ public void test() { assertTrue(sql.contains("order by t0.ship_date")); } - + @Test public void testWithCache() { ResetBasicData.reset(); @@ -46,10 +46,10 @@ public void testWithCache() { Query query = DB.find(OrderDetail.class).where().idIn(1,2,3).query(); query.setUseCache(true); query.findList(); - query.order().asc("cretime").findList(); // hit cache - query.order().clear(); + query.orderBy().asc("cretime").findList(); // hit cache + query.orderBy().clear(); query.findList(); // hit cache again - + } } diff --git a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByOnComplex.java b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByOnComplex.java index f2ef12851e..5da2bccfc7 100644 --- a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByOnComplex.java +++ b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByOnComplex.java @@ -19,7 +19,7 @@ public void test() { ResetBasicData.reset(); - Query query = DB.find(Order.class).order().desc("customer"); + Query query = DB.find(Order.class).orderBy().desc("customer"); query.findList(); @@ -33,7 +33,7 @@ public void testOrderByCase() { ResetBasicData.reset(); Query query = DB.find(Order.class) - .order("case when status=3 then 10 when status=2 then 11 else 99 end"); + .orderBy("case when status=3 then 10 when status=2 then 11 else 99 end"); List list = query.findList(); diff --git a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinct.java b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinct.java index c8a911da6b..bbdce3951a 100644 --- a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinct.java +++ b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinct.java @@ -32,7 +32,7 @@ public void testOrderByValidation() { .where() .eq("junk", "blah") .eq("name", "jim") - .order("id desc,path.that.does.not.exist,contacts.group.name asc").query(); + .orderBy("id desc,path.that.does.not.exist,contacts.group.name asc").query(); Set unknownProperties = query.validate(); assertThat(unknownProperties).isNotEmpty(); @@ -50,7 +50,7 @@ public void testDistinctOn() { Query query = DB.find(MUser.class) .where() .eq("roles", role) - .order("userName asc nulls first").query(); + .orderBy("userName asc nulls first").query(); query.findList(); @@ -149,7 +149,7 @@ public void test() { .fetch("userType", "name") .where() .eq("roles.roleName", "A") - .order("userType.name, userName").query(); + .orderBy("userType.name, userName").query(); List list = query.findList(); // select distinct t0.userid c0, t0.user_name c1, t1.id c2, t1.name c3 @@ -183,7 +183,7 @@ public void test() { .fetch("userType", "name") .where() .eq("roles.roleName", "A") - .order("userType.name").query(); + .orderBy("userType.name").query(); list = query.findList(); assertEquals(1, list.size()); diff --git a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinctTake2.java b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinctTake2.java index 7195fba575..b35f5962ba 100644 --- a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinctTake2.java +++ b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithDistinctTake2.java @@ -25,7 +25,7 @@ public void test() { Query query = DB.find(Customer.class) .select("id, name") .where().ilike("contacts.firstName", "R%") - .order("name desc").query(); + .orderBy("name desc").query(); query.findList(); @@ -53,7 +53,7 @@ public void testWithAscAndDesc() { Query query = DB.find(Customer.class) .select("id") .where().ilike("contacts.firstName", "R%") - .order("name asc,id desc").query(); + .orderBy("name asc,id desc").query(); query.findList(); diff --git a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithFunction.java b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithFunction.java index 24e3664ea0..7f69a5aa85 100644 --- a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithFunction.java +++ b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithFunction.java @@ -20,7 +20,7 @@ public void testWithFunction() { length = "len"; } - Query query = DB.find(Customer.class).order(length + "(name),name"); + Query query = DB.find(Customer.class).orderBy(length + "(name),name"); query.findList(); String sql = query.getGeneratedSql(); diff --git a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithMany.java b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithMany.java index b21249f4a9..e910ed8a34 100644 --- a/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithMany.java +++ b/ebean-test/src/test/java/org/tests/query/orderby/TestOrderByWithMany.java @@ -70,7 +70,7 @@ private void checkWithBuiltInManyBasic() { private void checkWithBuiltInMany() { - Query query = DB.find(Order.class).fetch("details").order().desc("customer.name"); + Query query = DB.find(Order.class).fetch("details").orderBy().desc("customer.name"); query.findList(); @@ -83,7 +83,7 @@ private void checkWithBuiltInMany() { private void checkAppendId() { - Query query = DB.find(Order.class).fetch("shipments").order().desc("customer.name"); + Query query = DB.find(Order.class).fetch("shipments").orderBy().desc("customer.name"); query.findList(); @@ -95,7 +95,7 @@ private void checkAppendId() { private void checkNone() { - Query query = DB.find(Order.class).order().desc("customer.name"); + Query query = DB.find(Order.class).orderBy().desc("customer.name"); query.findList(); @@ -109,7 +109,7 @@ private void checkNone() { private void checkBoth() { - Query query = DB.find(Order.class).fetch("shipments").order() + Query query = DB.find(Order.class).fetch("shipments").orderBy() .desc("customer.name, shipments.shipTime"); query.findList(); @@ -121,7 +121,7 @@ private void checkBoth() { private void checkPrepend() { - Query query = DB.find(Order.class).fetch("shipments").order() + Query query = DB.find(Order.class).fetch("shipments").orderBy() .desc("shipments.shipTime"); query.findList(); @@ -133,7 +133,7 @@ private void checkPrepend() { private void checkAlreadyIncluded() { - Query query = DB.find(Order.class).fetch("shipments").order() + Query query = DB.find(Order.class).fetch("shipments").orderBy() .desc("id, shipments.shipTime"); query.findList(); @@ -145,7 +145,7 @@ private void checkAlreadyIncluded() { private void checkAlreadyIncluded2() { - Query query = DB.find(Order.class).fetch("shipments").order() + Query query = DB.find(Order.class).fetch("shipments").orderBy() .desc("orderDate, id, shipments.shipTime"); query.findList(); diff --git a/ebean-test/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java b/ebean-test/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java index b445073b8e..d0ad848d7c 100644 --- a/ebean-test/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java +++ b/ebean-test/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java @@ -31,7 +31,7 @@ public void test() { .endJunction() .eq("open", true) .endJunction() - .order("whenCreated desc").query(); + .orderBy("whenCreated desc").query(); query.findList(); String generatedSql = sqlOf(query, 1); diff --git a/ebean-test/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java b/ebean-test/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java index 1f689e1231..7a1aa0a636 100644 --- a/ebean-test/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java +++ b/ebean-test/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java @@ -27,7 +27,7 @@ public void test() { Query query = DB.find(Order.class) .fetch("details") .where().eq("details.product.id", productId) - .order("cretime asc").query(); + .orderBy("cretime asc").query(); List list = query.findList(); diff --git a/ebean-test/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java b/ebean-test/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java index 8936626b7d..2a54a0985a 100644 --- a/ebean-test/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java +++ b/ebean-test/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java @@ -76,7 +76,7 @@ void exampleUsage() { .setDistinct(true) .select("name") .where().eq("status", Customer.Status.NEW).startsWith("name", "R") - .order().asc("name") + .orderBy().asc("name") .setMaxRows(100) .findSingleAttributeList(); @@ -95,7 +95,7 @@ void exampleUsage_otherType() { .setDistinct(true) .select("anniversary") .where().isNotNull("anniversary") - .order().asc("anniversary") + .orderBy().asc("anniversary") .findSingleAttributeList(); assertThat(dates).isNotNull(); @@ -502,7 +502,7 @@ void distinctWithOrderByPk() { Query query = DB.find(Contact.class) .setDistinct(true) .select("customer") - .order().desc("customer"); + .orderBy().desc("customer"); query.findSingleAttributeList(); @@ -516,7 +516,7 @@ void distinctWithOrderByPkWithId() { Query query = DB.find(Contact.class) .setDistinct(true) .select("customer.id") - .order().desc("customer.id"); + .orderBy().desc("customer.id"); query.findSingleAttributeList(); @@ -530,7 +530,7 @@ void distinctWithCascadedFetchOrderByPk() { Query query = DB.find(Contact.class) .setDistinct(true) .fetch("customer", "billingAddress") - .order().desc("customer.billingAddress"); + .orderBy().desc("customer.billingAddress"); query.findSingleAttributeList(); @@ -545,7 +545,7 @@ void distinctWithOrderByPkAndQuery() { .setDistinct(true) .fetch("customer", "billingAddress") .where().eq("customer.billingAddress.city", "Auckland") - .order().desc("customer.billingAddress.id"); + .orderBy().desc("customer.billingAddress.id"); List ids = query.findSingleAttributeList(); assertThat(ids).isNotEmpty(); @@ -565,7 +565,7 @@ void distinctWithCascadedFetchOrderByPkAndQuery() { .setDistinct(true) .fetch("customer", "billingAddress") .where().eq("customer.billingAddress.city", "Auckland") - .order().desc("customer.billingAddress.id"); + .orderBy().desc("customer.billingAddress.id"); List ids = query.findSingleAttributeList(); assertThat(ids).isNotEmpty(); @@ -585,7 +585,7 @@ void distinctWithCascadedFetchOrderByPkAndQuery3() { .setDistinct(true) .fetch("customer", "billingAddress") .where().eq("customer.billingAddress.city", "Auckland") - .order().desc("customer.billingAddress.id"); + .orderBy().desc("customer.billingAddress.id"); List ids = query.findSingleAttributeList(); assertThat(ids).isNotEmpty(); @@ -605,7 +605,7 @@ void distinctWithCascadedFetchOrderByPkAndQuery2() { .setDistinct(true) .fetch("customer", "billingAddress") .where().eq("customer.shippingAddress.city", "Auckland") // query on shippingAddress - .order().desc("customer.billingAddress.id"); + .orderBy().desc("customer.billingAddress.id"); List ids = query.findSingleAttributeList(); assertThat(ids).isNotEmpty(); diff --git a/ebean-test/src/test/java/org/tests/query/other/TestWhereAnnotation.java b/ebean-test/src/test/java/org/tests/query/other/TestWhereAnnotation.java index a3b5875751..11f68d484b 100644 --- a/ebean-test/src/test/java/org/tests/query/other/TestWhereAnnotation.java +++ b/ebean-test/src/test/java/org/tests/query/other/TestWhereAnnotation.java @@ -45,7 +45,7 @@ public void fetchLazy_inLazyLoadQuery() { LoggedSql.start(); List customers = DB.find(Customer.class) - .order().asc("id") + .orderBy().asc("id") .findList(); List orders = customers.get(0).getOrders(); diff --git a/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmQuery.java b/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmQuery.java index 48a5733432..4c6c69b16b 100644 --- a/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmQuery.java +++ b/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmQuery.java @@ -133,7 +133,7 @@ void testFirstRowsMaxRows() throws InterruptedException, ExecutionException { query.setFirstRow(1); query.setMaxRows(2); - query.order("id"); + query.orderBy("id"); List list = query.findList(); @@ -263,14 +263,14 @@ void testPaging_when_setOrderBy_expect_id_appendToOrderBy() { query.setMaxRows(100); if (isSqlServer()) { - query.order("coalesce(shipDate, getdate()) desc"); + query.orderBy("coalesce(shipDate, getdate()) desc"); query.findList(); assertThat(sqlOf(query)).contains("order by coalesce(o.ship_date, getdate()) desc"); assertThat(sqlOf(query)).contains("select top 100"); } else { - query.order("coalesce(shipDate, now()) desc"); + query.orderBy("coalesce(shipDate, now()) desc"); query.findList(); if (isDb2()) { @@ -299,14 +299,14 @@ void testPaging_when_setOrderBy_expect_id_appendToOrderBy_with_id() { query.orderById(true); if (isSqlServer()) { - query.order("coalesce(shipDate, getdate()) desc"); + query.orderBy("coalesce(shipDate, getdate()) desc"); query.findList(); assertThat(sqlOf(query)).contains("order by coalesce(o.ship_date, getdate()) desc, o.id"); assertThat(sqlOf(query)).contains("select top 100"); } else { - query.order("coalesce(shipDate, now()) desc"); + query.orderBy("coalesce(shipDate, now()) desc"); query.findList(); if (isDb2()) { @@ -331,7 +331,7 @@ void testPaging_when_setOrderBy_containsId_expect_leaveAsIs() { query.setRawSql(rawSql); query.setMaxRows(100); - query.order("id desc"); + query.orderBy("id desc"); PagedList pagedList = query.findPagedList(); pagedList.getList(); pagedList.getTotalCount(); diff --git a/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmWrapper2.java b/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmWrapper2.java index d961ecf539..984cc1a18e 100644 --- a/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmWrapper2.java +++ b/ebean-test/src/test/java/org/tests/rawsql/TestRawSqlOrmWrapper2.java @@ -30,7 +30,7 @@ public void test() { Query query = DB.find(OrderAggregate.class); query.setRawSql(rawSql).fetchQuery("order", "status,orderDate") .fetch("order.customer", "name").where().gt("order.id", 0).having().gt("totalAmount", 20) - .order().desc("totalAmount").setMaxRows(10); + .orderBy().desc("totalAmount").setMaxRows(10); List list = query.findList(); assertNotNull(list); diff --git a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonBeanReadVisitor.java b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonBeanReadVisitor.java index 00fa481cd6..8e2fd65392 100644 --- a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonBeanReadVisitor.java +++ b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonBeanReadVisitor.java @@ -25,7 +25,7 @@ public void test() throws IOException { .fetch("billingAddress", "line1, city") .fetch("billingAddress.country", "*") .fetch("contacts", "firstName,email") - .order().desc("id").findList(); + .orderBy().desc("id").findList(); JsonContext json = DB.json(); diff --git a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReadManyLazyLoad.java b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReadManyLazyLoad.java index 33ea392f1c..facc594793 100644 --- a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReadManyLazyLoad.java +++ b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReadManyLazyLoad.java @@ -21,7 +21,7 @@ public void test_lazyLoadBoth() { ResetBasicData.reset(); - List list = DB.find(Customer.class).select("id, status, shippingAddress").order() + List list = DB.find(Customer.class).select("id, status, shippingAddress").orderBy() .desc("id").findList(); JsonContext json = DB.json(); @@ -42,7 +42,7 @@ public void test_lazyLoadCust() throws IOException { ResetBasicData.reset(); List list = DB.find(Customer.class).select("id, status, shippingAddress") - .fetch("contacts").order().desc("id").findList(); + .fetch("contacts").orderBy().desc("id").findList(); JsonContext json = DB.json(); @@ -63,7 +63,7 @@ public void test_lazyLoadContacts() { List list = DB.find(Customer.class).select("id, name, status, shippingAddress") // .fetch("contacts") - .order().desc("id").findList(); + .orderBy().desc("id").findList(); JsonContext json = DB.json(); diff --git a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReferenceBean.java b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReferenceBean.java index 8f0107a74e..1bf4e1f197 100644 --- a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReferenceBean.java +++ b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonReferenceBean.java @@ -72,7 +72,7 @@ public void test() throws IOException { // .setUseCache(false) .select("status, orderDate, shipDate, customer").fetch("details", "*") // .fetch("details.product","id") - .order().asc("id").findList(); + .orderBy().asc("id").findList(); Order order = orders.get(0); diff --git a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSimple.java b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSimple.java index 754ffd87d3..c7d4387a57 100644 --- a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSimple.java +++ b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSimple.java @@ -66,7 +66,7 @@ public void test() throws IOException { .select("id, name, status, shippingAddress") .fetch("billingAddress", "line1, city").fetch("billingAddress.country", "*") .fetch("contacts", "firstName,email") - .order().desc("id").findList(); + .orderBy().desc("id").findList(); Database server = DB.getDefault(); @@ -102,7 +102,7 @@ public void testTransientIncludedByDefault() { List list = DB.find(Customer.class) .select("id, name") - .order().desc("id").findList(); + .orderBy().desc("id").findList(); Database server = DB.getDefault(); @@ -125,7 +125,7 @@ public void testTransientIncludedExplicitly() { List list = DB.find(Customer.class) .select("id, name") - .order().desc("id").findList(); + .orderBy().desc("id").findList(); Database server = DB.getDefault(); diff --git a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSuperSimple.java b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSuperSimple.java index e0b026deda..a9e0d0d941 100644 --- a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSuperSimple.java +++ b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonSuperSimple.java @@ -20,7 +20,7 @@ public void test() throws IOException { ResetBasicData.reset(); - List list = DB.find(Customer.class).select("id, name").order().desc("id") + List list = DB.find(Customer.class).select("id, name").orderBy().desc("id") .findList(); Database server = DB.getDefault(); diff --git a/ebean-test/src/test/java/org/tests/update/TestUpdateAllLoadedProperties.java b/ebean-test/src/test/java/org/tests/update/TestUpdateAllLoadedProperties.java index 1b06ca0f10..ec47d2f80f 100644 --- a/ebean-test/src/test/java/org/tests/update/TestUpdateAllLoadedProperties.java +++ b/ebean-test/src/test/java/org/tests/update/TestUpdateAllLoadedProperties.java @@ -65,7 +65,7 @@ private void testPartiallyLoaded(Integer id1, Integer id2) { List beans = DB.find(EBasicVer.class) .select("name, other") .where().idIn(ids) - .order().asc("id") + .orderBy().asc("id") .findList(); assertEquals(2, beans.size()); From 83ce53660a427565f824c51a2af4ab96b5e8a6de Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Thu, 24 Oct 2024 14:53:22 +0200 Subject: [PATCH 2/7] Replaced .setOrder() with .setOrderBy() --- .../main/java/io/ebeaninternal/server/query/CQueryBuilder.java | 2 +- .../io/ebeaninternal/server/querydefn/OrmQueryProperties.java | 2 +- .../java/org/tests/text/json/TestTextJsonUpdateCascade.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java index 093d6933c6..bdadafa3d4 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java @@ -233,7 +233,7 @@ CQueryDraftSupport draftSupport(SpiQuery query) { CQueryRowCount buildRowCountQuery(OrmQueryRequest request) { SpiQuery query = request.query(); // always set the order by to null for row count query - query.setOrder(null); + query.setOrderBy(null); query.setFirstRow(0); query.setMaxRows(0); diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java index a003f42061..94bb5ab619 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java @@ -247,7 +247,7 @@ public void configureBeanQuery(SpiQuery query) { } if (orderBy != null) { - query.setOrder(orderBy.copyWithTrim(path)); + query.setOrderBy(orderBy.copyWithTrim(path)); } } diff --git a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonUpdateCascade.java b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonUpdateCascade.java index b990a09a5c..99354f8b44 100644 --- a/ebean-test/src/test/java/org/tests/text/json/TestTextJsonUpdateCascade.java +++ b/ebean-test/src/test/java/org/tests/text/json/TestTextJsonUpdateCascade.java @@ -45,7 +45,7 @@ public void test() throws IOException { Product p = DB.reference(Product.class, 1); OrderDetail newDetail = new OrderDetail(p, 899, BigDecimal.valueOf(12.12d)); - // newDetail.setOrder(order); + // newDetail.setOrderBy(order); order.addDetail(newDetail); Database server = DB.getDefault(); From 597644cfe33e64a08f4d1487c0239a83f287a40e Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Thu, 24 Oct 2024 15:07:26 +0200 Subject: [PATCH 3/7] Replaced new OrderBy<>(...) with OrderBy.of(...) --- .../tests/unitinternal/TestOrderByParse.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/ebean-test/src/test/java/org/tests/unitinternal/TestOrderByParse.java b/ebean-test/src/test/java/org/tests/unitinternal/TestOrderByParse.java index 2a23f72730..a20fd8e79d 100644 --- a/ebean-test/src/test/java/org/tests/unitinternal/TestOrderByParse.java +++ b/ebean-test/src/test/java/org/tests/unitinternal/TestOrderByParse.java @@ -15,7 +15,7 @@ public class TestOrderByParse extends BaseTestCase { @Test public void testParseRaw() { - OrderBy o1 = new OrderBy<>("case when status='N' then 1 when status='F' then 2 else 99 end"); + OrderBy o1 = OrderBy.of("case when status='N' then 1 when status='F' then 2 else 99 end"); assertEquals(1, o1.getProperties().size()); assertTrue(o1.getProperties().get(0).isAscending()); assertThat(o1.toStringFormat()).isEqualTo("case when status='N' then 1 when status='F' then 2 else 99 end"); @@ -25,25 +25,25 @@ public void testParseRaw() { @Test public void testParsingOne() { - OrderBy o1 = new OrderBy<>("id"); + OrderBy o1 = OrderBy.of("id"); assertEquals(1, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertTrue(o1.getProperties().get(0).isAscending()); assertEquals("id", o1.toStringFormat()); - o1 = new OrderBy<>("id asc"); + o1 = OrderBy.of("id asc"); assertEquals(1, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertTrue(o1.getProperties().get(0).isAscending()); assertEquals("id", o1.toStringFormat()); - o1 = new OrderBy<>("id desc"); + o1 = OrderBy.of("id desc"); assertEquals(1, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertFalse(o1.getProperties().get(0).isAscending()); assertEquals("id desc", o1.toStringFormat()); - o1 = new OrderBy<>(" id asc "); + o1 = OrderBy.of(" id asc "); assertEquals(1, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertTrue(o1.getProperties().get(0).isAscending()); @@ -56,7 +56,7 @@ public void testParsingOne() { @Test public void parseNullsHigh() { - OrderBy o1 = new OrderBy<>("id desc nulls high"); + OrderBy o1 = OrderBy.of("id desc nulls high"); assertEquals(1, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertFalse(o1.getProperties().get(0).isAscending()); @@ -64,6 +64,7 @@ public void parseNullsHigh() { } @Test + @SuppressWarnings("removal") // uses internal API public void add_parse() { OrderBy o1 = new OrderBy<>(); @@ -77,7 +78,7 @@ public void add_parse() { @Test public void parseNullsHigh_with_second() { - OrderBy o1 = new OrderBy<>("id desc nulls high, name"); + OrderBy o1 = OrderBy.of("id desc nulls high, name"); assertEquals(2, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertFalse(o1.getProperties().get(0).isAscending()); @@ -89,7 +90,7 @@ public void parseNullsHigh_with_second() { @Test public void testParsingTwo() { - OrderBy o1 = new OrderBy<>("id,name"); + OrderBy o1 = OrderBy.of("id,name"); assertEquals(2, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertTrue(o1.getProperties().get(0).isAscending()); @@ -97,7 +98,7 @@ public void testParsingTwo() { assertTrue(o1.getProperties().get(1).isAscending()); assertEquals("id, name", o1.toStringFormat()); - o1 = new OrderBy<>(" id , name "); + o1 = OrderBy.of(" id , name "); assertEquals(2, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertTrue(o1.getProperties().get(0).isAscending()); @@ -105,7 +106,7 @@ public void testParsingTwo() { assertTrue(o1.getProperties().get(1).isAscending()); assertEquals("id, name", o1.toStringFormat()); - o1 = new OrderBy<>(" id desc , name desc "); + o1 = OrderBy.of(" id desc , name desc "); assertEquals(2, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertFalse(o1.getProperties().get(0).isAscending()); @@ -113,7 +114,7 @@ public void testParsingTwo() { assertFalse(o1.getProperties().get(1).isAscending()); assertEquals("id desc, name desc", o1.toStringFormat()); - o1 = new OrderBy<>(" id ascending, name asc"); + o1 = OrderBy.of(" id ascending, name asc"); assertEquals(2, o1.getProperties().size()); assertEquals("id", o1.getProperties().get(0).getProperty()); assertTrue(o1.getProperties().get(0).isAscending()); @@ -124,6 +125,7 @@ public void testParsingTwo() { } @Test + @SuppressWarnings("removal") // uses internal API public void testAddMethods() { OrderBy o1 = new OrderBy<>(); @@ -166,6 +168,7 @@ public void testAddMethods() { } @Test + @SuppressWarnings("removal") // uses internal API public void testParsingWithCollation() { OrderBy o1 = new OrderBy<>(); @@ -212,19 +215,20 @@ public void testParsingWithCollation() { } @Test + @SuppressWarnings("removal") // uses internal API public void equals_with_nulls() { - OrderBy o1 = new OrderBy<>("id desc nulls high"); - OrderBy o2 = new OrderBy<>("id desc nulls high"); + OrderBy o1 = OrderBy.of("id desc nulls high"); + OrderBy o2 = OrderBy.of("id desc nulls high"); OrderBy o3 = new OrderBy<>(); o3.add("id desc nulls high"); assertEquals(o1, o2); assertEquals(o1, o3); - OrderBy o4 = new OrderBy<>("id desc"); - OrderBy o5 = new OrderBy<>("oid desc nulls high"); - OrderBy o6 = new OrderBy<>("id desc nulls low"); + OrderBy o4 = OrderBy.of("id desc"); + OrderBy o5 = OrderBy.of("oid desc nulls high"); + OrderBy o6 = OrderBy.of("id desc nulls low"); assertNotEquals(o1, o4); assertNotEquals(o1, o5); @@ -232,6 +236,7 @@ public void equals_with_nulls() { } @Test + @SuppressWarnings("removal") // uses internal API public void equals_with_collation() { OrderBy o1 = new OrderBy<>(); o1.asc("name", "latin_1"); From db5e1b2f454e104ccff59e5fc574056b11bdf456 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Thu, 24 Oct 2024 15:26:14 +0200 Subject: [PATCH 4/7] Replaced deprecated setters from DataSourceConfig/DataSourceBuilder --- .../server/core/InitDataSourceTest.java | 2 +- .../io/ebean/test/config/platform/Config.java | 14 ++++++------- .../test/config/platform/NuoDBSetup.java | 2 +- .../config/PlatformNoGeneratedKeysTest.java | 8 ++++---- .../java/org/tests/basic/MainDbBoolean.java | 20 +++++++++---------- .../tests/basic/TestPersistenceContext.java | 12 +++++------ .../basic/TestPersistenceContextMany.java | 12 +++++------ .../org/tests/json/TestJsonSourceDefault.java | 6 +++--- .../org/tests/unitinternal/HelloMain.java | 8 ++++---- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java index 2e0779da00..785498ed92 100644 --- a/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java +++ b/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java @@ -22,7 +22,7 @@ public class InitDataSourceTest { private DatabaseBuilder.Settings newConfig(String readOnlyUrl) { DatabaseBuilder config = new DatabaseConfig(); DataSourceConfig roConfig = new DataSourceConfig(); - roConfig.setUrl(readOnlyUrl); + roConfig.url(readOnlyUrl); config.setReadOnlyDataSourceConfig(roConfig); return config.settings(); } diff --git a/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java b/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java index 3c8488798c..e00ccd969a 100644 --- a/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java +++ b/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java @@ -195,16 +195,16 @@ private DataSourceConfig datasourceDefaults(String platform) { } DataSourceConfig ds = new DataSourceConfig(); - ds.setUsername(datasourceProperty(platform, "username", username)); - ds.setPassword(datasourceProperty(platform, "password", password)); - ds.setOwnerUsername(datasourceProperty(platform, "ownerUsername", null)); - ds.setOwnerPassword(datasourceProperty(platform, "ownerPassword", null)); - ds.setUrl(datasourceProperty(platform, "url", url)); + ds.username(datasourceProperty(platform, "username", username)); + ds.password(datasourceProperty(platform, "password", password)); + ds.ownerUsername(datasourceProperty(platform, "ownerUsername", null)); + ds.ownerPassword(datasourceProperty(platform, "ownerPassword", null)); + ds.url(datasourceProperty(platform, "url", url)); String driverClass = datasourceProperty(platform, "driver", driver); - ds.setDriver(driverClass); + ds.driver(driverClass); config.setDataSourceConfig(ds); - log.log(INFO, "Using jdbc settings - username:{0} url:{1} driver:{2}", ds.getUsername(), ds.getUrl(), ds.getDriver()); + log.log(INFO, "Using jdbc settings - username:{0} url:{1} driver:{2}", ds.getUsername(), ds.getUrl(), ds.driverClassName()); if (driverClass != null) { try { Class.forName(driverClass); diff --git a/ebean-test/src/main/java/io/ebean/test/config/platform/NuoDBSetup.java b/ebean-test/src/main/java/io/ebean/test/config/platform/NuoDBSetup.java index b339c24a2b..5eac2463c3 100644 --- a/ebean-test/src/main/java/io/ebean/test/config/platform/NuoDBSetup.java +++ b/ebean-test/src/main/java/io/ebean/test/config/platform/NuoDBSetup.java @@ -18,7 +18,7 @@ public Properties setup(Config config) { config.setDriver("com.nuodb.jdbc.Driver"); final DataSourceConfig dsConfig = config.datasourceDefaults(); - dsConfig.setSchema(config.getSchema()); + dsConfig.schema(config.getSchema()); return dockerProperties(config); } diff --git a/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java b/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java index db3c9622bd..c0bcf8debe 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java +++ b/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java @@ -101,10 +101,10 @@ private static Database testH2Server() { dbIdentity.setSelectLastInsertedIdTemplate("select identity() --{table}"); config.setDatabasePlatform(platform); - config.getDataSourceConfig().setUsername("sa"); - config.getDataSourceConfig().setPassword(""); - config.getDataSourceConfig().setUrl("jdbc:h2:mem:withPCQuery;MODE=LEGACY"); - config.getDataSourceConfig().setDriver("org.h2.Driver"); + config.getDataSourceConfig().username("sa"); + config.getDataSourceConfig().password(""); + config.getDataSourceConfig().url("jdbc:h2:mem:withPCQuery;MODE=LEGACY"); + config.getDataSourceConfig().driver("org.h2.Driver"); config.setDisableLazyLoading(true); config.setDisableL2Cache(true); diff --git a/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java b/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java index 985fb31f42..c8766d4b3f 100644 --- a/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java +++ b/ebean-test/src/test/java/org/tests/basic/MainDbBoolean.java @@ -44,11 +44,11 @@ private Database createOracleEbeanServer() { // requires oracle driver in class path DataSourceConfig oraDb = new DataSourceConfig(); - oraDb.setDriver("oracle.jdbc.driver.OracleDriver"); - oraDb.setUsername("junk"); - oraDb.setPassword("junk"); - oraDb.setUrl("jdbc:oracle:thin:junk/junk@localhost:1521:XE"); - oraDb.setHeartbeatSql("select count(*) from dual"); + oraDb.driver("oracle.jdbc.driver.OracleDriver"); + oraDb.username("junk"); + oraDb.password("junk"); + oraDb.url("jdbc:oracle:thin:junk/junk@localhost:1521:XE"); + oraDb.heartbeatSql("select count(*) from dual"); c.loadFromProperties(); @@ -77,11 +77,11 @@ private Database createEbeanServer() { // requires postgres driver in class path DataSourceConfig postgresDb = new DataSourceConfig(); - postgresDb.setDriver("org.postgresql.Driver"); - postgresDb.setUsername("test"); - postgresDb.setPassword("test"); - postgresDb.setUrl("jdbc:postgresql://127.0.0.1:5432/test"); - postgresDb.setHeartbeatSql("select count(*) from t_one"); + postgresDb.driver("org.postgresql.Driver"); + postgresDb.username("test"); + postgresDb.password("test"); + postgresDb.url("jdbc:postgresql://127.0.0.1:5432/test"); + postgresDb.heartbeatSql("select count(*) from t_one"); c.loadFromProperties(); c.setDdlGenerate(true); diff --git a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java index 3bfa60b613..d9fa3a8498 100644 --- a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java +++ b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java @@ -254,9 +254,9 @@ void initDb() { config.setName("h2-batch"); config.loadFromProperties(); config.setDdlExtra(false); - config.getDataSourceConfig().setUsername("sa"); - config.getDataSourceConfig().setPassword("sa"); - config.getDataSourceConfig().setUrl("jdbc:h2:file:./testsFile3;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); + config.getDataSourceConfig().username("sa"); + config.getDataSourceConfig().password("sa"); + config.getDataSourceConfig().url("jdbc:h2:file:./testsFile3;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); config.addClass(TestModel2.class); config.addClass(TmId.class); DatabaseFactory.create(config); @@ -288,9 +288,9 @@ void testFindEachFindList() { config.setName("h2-batch"); config.loadFromProperties(); config.setDdlRun(false); - config.getDataSourceConfig().setUsername("sa"); - config.getDataSourceConfig().setPassword("sa"); - config.getDataSourceConfig().setUrl("jdbc:h2:file:./testsFile3;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); + config.getDataSourceConfig().username("sa"); + config.getDataSourceConfig().password("sa"); + config.getDataSourceConfig().url("jdbc:h2:file:./testsFile3;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); config.addClass(TestModel2.class); config.addClass(TmId.class); DatabaseFactory.create(config); diff --git a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java index cf91280b71..b4e4908319 100644 --- a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java +++ b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java @@ -102,9 +102,9 @@ void initDb() { config.setName("h2-batch"); config.loadFromProperties(); config.setDdlExtra(false); - config.getDataSourceConfig().setUsername("sa"); - config.getDataSourceConfig().setPassword("sa"); - config.getDataSourceConfig().setUrl("jdbc:h2:file:./testsFileMany;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); + config.getDataSourceConfig().username("sa"); + config.getDataSourceConfig().password("sa"); + config.getDataSourceConfig().url("jdbc:h2:file:./testsFileMany;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); config.addClass(TestModel3.class); config.addClass(TestModel3A.class); config.addClass(TestModel3B.class); @@ -146,9 +146,9 @@ void testFindEachFindList() { config.setName("h2-batch"); config.loadFromProperties(); config.setDdlRun(false); - config.getDataSourceConfig().setUsername("sa"); - config.getDataSourceConfig().setPassword("sa"); - config.getDataSourceConfig().setUrl("jdbc:h2:file:./testsFileMany;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); + config.getDataSourceConfig().username("sa"); + config.getDataSourceConfig().password("sa"); + config.getDataSourceConfig().url("jdbc:h2:file:./testsFileMany;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE"); config.addClass(TestModel3.class); config.addClass(TestModel3A.class); config.addClass(TestModel3B.class); diff --git a/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java b/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java index 91d83fd14b..af35c893a6 100644 --- a/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java +++ b/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java @@ -25,9 +25,9 @@ class TestJsonSourceDefault { void testDirtyValues_diffSource() { DatabaseConfig config = new DatabaseConfig(); config.getDataSourceConfig() - .setUsername("sa") - .setPassword("") - .setUrl("jdbc:h2:mem:testJsonSourceDirtyValues"); + .username("sa") + .password("") + .url("jdbc:h2:mem:testJsonSourceDirtyValues"); config.setName("jsonSource"); config.setDefaultServer(false); diff --git a/ebean-test/src/test/java/org/tests/unitinternal/HelloMain.java b/ebean-test/src/test/java/org/tests/unitinternal/HelloMain.java index 6b79099409..c7a6cd31c4 100644 --- a/ebean-test/src/test/java/org/tests/unitinternal/HelloMain.java +++ b/ebean-test/src/test/java/org/tests/unitinternal/HelloMain.java @@ -22,10 +22,10 @@ public static void main(String[] args) { // ### Configuration Settings ### // -> data source - dataSourceConfig.setDriver("org.h2.Driver"); - dataSourceConfig.setUsername("howtouser"); - dataSourceConfig.setPassword(""); - dataSourceConfig.setUrl("jdbc:h2:~/db/howto1"); + dataSourceConfig.driver("org.h2.Driver"); + dataSourceConfig.username("howtouser"); + dataSourceConfig.password(""); + dataSourceConfig.url("jdbc:h2:~/db/howto1"); // -> server serverConfig.setName("default"); From 60365bb5945a5b3a2479ae3f10cc1f5afbee2792 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Thu, 24 Oct 2024 15:29:37 +0200 Subject: [PATCH 5/7] Add missing @Deprecated annotations --- ebean-api/src/main/java/io/ebean/DatabaseBuilder.java | 3 +++ ebean-api/src/main/java/io/ebean/PagedList.java | 1 + 2 files changed, 4 insertions(+) diff --git a/ebean-api/src/main/java/io/ebean/DatabaseBuilder.java b/ebean-api/src/main/java/io/ebean/DatabaseBuilder.java index 985ba1760e..392823b81b 100644 --- a/ebean-api/src/main/java/io/ebean/DatabaseBuilder.java +++ b/ebean-api/src/main/java/io/ebean/DatabaseBuilder.java @@ -283,6 +283,7 @@ default DatabaseBuilder lazyLoadBatchSize(int lazyLoadBatchSize) { /** * @deprecated migrate to {@link #lazyLoadBatchSize(int)}. */ + @Deprecated DatabaseBuilder setLazyLoadBatchSize(int lazyLoadBatchSize); /** @@ -371,6 +372,7 @@ default DatabaseBuilder jsonFactory(JsonFactory jsonFactory) { /** * @deprecated migrate to {@link #jsonFactory(JsonFactory)}. */ + @Deprecated DatabaseBuilder setJsonFactory(JsonFactory jsonFactory); /** @@ -383,6 +385,7 @@ default DatabaseBuilder jsonDateTime(JsonConfig.DateTime jsonDateTime) { /** * @deprecated migrate to {@link #jsonDateTime(JsonConfig.DateTime)}. */ + @Deprecated DatabaseBuilder setJsonDateTime(JsonConfig.DateTime jsonDateTime); /** diff --git a/ebean-api/src/main/java/io/ebean/PagedList.java b/ebean-api/src/main/java/io/ebean/PagedList.java index 3b8a0d4d40..ac8ae8a281 100644 --- a/ebean-api/src/main/java/io/ebean/PagedList.java +++ b/ebean-api/src/main/java/io/ebean/PagedList.java @@ -62,6 +62,7 @@ public interface PagedList { /** * Return an empty PagedList. */ + @SuppressWarnings("removal") // uses internal API static PagedList emptyList() { return new EmptyPagedList<>(); } From f0f93c1a9df43b8a692ee7c3711022ec452e7d2e Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Thu, 24 Oct 2024 15:32:25 +0200 Subject: [PATCH 6/7] Migrate query.update(txn)/.delete(txn) to .usingTransaction(txn) --- .../java/io/ebean/xtest/base/UpdateQueryTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ebean-test/src/test/java/io/ebean/xtest/base/UpdateQueryTest.java b/ebean-test/src/test/java/io/ebean/xtest/base/UpdateQueryTest.java index 9ad14fd339..2f4878a8b4 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/base/UpdateQueryTest.java +++ b/ebean-test/src/test/java/io/ebean/xtest/base/UpdateQueryTest.java @@ -356,14 +356,17 @@ public void updateQuery_withExplicitTransaction() { .setRaw("status = coalesce(status, ?)", Customer.Status.ACTIVE) .where() .gt("id", 10000) - .update(transaction); // .usingTransaction(transaction).update(); + .usingTransaction(transaction) + .update(); // .usingTransaction(transaction).update(); rowsQuery = server .update(Customer.class) .setRaw("status = coalesce(status, ?)", Customer.Status.ACTIVE) .where() .gt("id", 10001) - .query().update(transaction); + .query() + .usingTransaction(transaction) + .update(); transaction.commit(); } @@ -387,13 +390,16 @@ public void deleteQuery_withExplicitTransaction() { .update(Customer.class) .where() .gt("id", 10000) - .delete(transaction); + .usingTransaction(transaction) + .delete(); rowsQuery = server .update(Customer.class) .where() .gt("id", 10001) - .query().delete(transaction); + .query() + .usingTransaction(transaction) + .delete(); transaction.commit(); } From 60b89450ff1e6597bf1566ab8cdb20d3b2914569 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Thu, 24 Oct 2024 15:44:52 +0200 Subject: [PATCH 7/7] Marked methods, that still use or test deprecated methods --- .../server/expression/DefaultExpressionList.java | 3 +++ .../ebeaninternal/server/expression/JunctionExpression.java | 3 +++ .../io/ebeaninternal/server/query/DefaultFetchGroupQuery.java | 3 +++ .../io/ebeaninternal/server/querydefn/DefaultOrmQuery.java | 4 ++++ .../io/ebeaninternal/server/querydefn/OrmQueryProperties.java | 4 ++-- .../src/test/java/org/tests/query/TestQueryFilterMany.java | 2 ++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExpressionList.java b/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExpressionList.java index 9067667b93..c3923a9e84 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExpressionList.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExpressionList.java @@ -333,6 +333,7 @@ public int delete() { } @Override + @SuppressWarnings("removal") // old API public int delete(Transaction transaction) { return query.delete(transaction); } @@ -343,6 +344,7 @@ public int update() { } @Override + @SuppressWarnings("removal") // old API public int update(Transaction transaction) { return query.update(transaction); } @@ -444,6 +446,7 @@ public ExpressionList filterMany(String manyProperty) { } @Override + @SuppressWarnings("removal") // old API public ExpressionList filterMany(String manyProperty, String expressions, Object... params) { return query.filterMany(manyProperty).where(expressions, params); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java b/ebean-core/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java index 0251b711c3..66021e4e07 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java @@ -313,6 +313,7 @@ public ExpressionList filterMany(String prop) { } @Override + @SuppressWarnings("removal") // old API public ExpressionList filterMany(String manyProperty, String expressions, Object... params) { throw new IllegalStateException("filterMany not allowed on Junction expression list"); } @@ -338,6 +339,7 @@ public int delete() { } @Override + @SuppressWarnings("removal") // old API public int delete(Transaction transaction) { return exprList.delete(transaction); } @@ -348,6 +350,7 @@ public int update() { } @Override + @SuppressWarnings("removal") // old API public int update(Transaction transaction) { return exprList.update(transaction); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java index c71dbe8dba..95972fb9e3 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java @@ -341,6 +341,7 @@ public int delete() { } @Override + @SuppressWarnings("removal") // old API public int delete(Transaction transaction) { throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup"); } @@ -351,6 +352,7 @@ public int update() { } @Override + @SuppressWarnings("removal") // old API public int update(Transaction transaction) { throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup"); } @@ -446,6 +448,7 @@ public Query orderBy(String orderByClause) { } @Override + @SuppressWarnings("removal") // uses internal API public OrderBy orderBy() { if (orderBy == null) { orderBy = new OrderBy<>(); diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java index 0a433669a1..3c937552f6 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java @@ -1482,6 +1482,7 @@ public final int delete() { } @Override + @SuppressWarnings("removal") // old API public final int delete(Transaction transaction) { return server.delete(this); } @@ -1492,6 +1493,7 @@ public final int update() { } @Override + @SuppressWarnings("removal") // old API public final int update(Transaction transaction) { return server.update(this); } @@ -1688,6 +1690,7 @@ public final OrderBy getOrderBy() { } @Override + @SuppressWarnings("removal") // uses internal API public final OrderBy orderBy() { if (orderBy == null) { orderBy = new OrderBy<>(this, null); @@ -1696,6 +1699,7 @@ public final OrderBy orderBy() { } @Override + @SuppressWarnings("removal") // uses internal API public final Query orderBy(String orderByClause) { if (orderByClause == null || orderByClause.trim().isEmpty()) { this.orderBy = null; diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java index 94bb5ab619..8325ced6af 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/OrmQueryProperties.java @@ -150,7 +150,7 @@ public OrmQueryProperties copy(FetchConfig fetchConfig) { /** * Move a OrderBy.Property from the main query to this query join. */ - @SuppressWarnings("rawtypes") + @SuppressWarnings({ "rawtypes", "removal"}) // uses internal API void addSecJoinOrderProperty(OrderBy.Property orderProp) { if (orderBy == null) { orderBy = new OrderBy(); @@ -222,7 +222,7 @@ public void setFilterMany(SpiExpressionList filterMany) { /** * Define the select and joins for this query. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "removal"}) // uses internal API public void configureBeanQuery(SpiQuery query) { if (hasProperties()) { query.selectProperties(this); diff --git a/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java b/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java index c5846aa9cc..d9ef32eb53 100644 --- a/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java +++ b/ebean-test/src/test/java/org/tests/query/TestQueryFilterMany.java @@ -106,6 +106,7 @@ public void test_firstMaxRows() { } @Test + @SuppressWarnings("removal") // tests deprecated API public void filterMany_firstMaxRows_expressionFluidStyle() { ResetBasicData.reset(); @@ -375,6 +376,7 @@ public void testFetchAndFilterMany() { } @Test + @SuppressWarnings("removal") // tests deprecated API public void testFilterManyUsingExpression() { ResetBasicData.reset();