Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Remove some deprecated warnings #3506

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/DB.java
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ public static <T> T reference(Class<T> beanType, Object id) {
* // find orders and their customers
* List<Order> list = DB.find(Order.class)
* .fetch("customer")
* .order("id")
* .orderBy("id")
* .findList();
*
* // sort by customer name ascending, then by order shipDate
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static DatabaseBuilder builder() {
* // find orders and their customers
* List<Order> list = database.find(Order.class)
* .fetch("customer")
* .order("id")
* .orderBy("id")
* .findList();
*
* // sort by customer name ascending, then by order shipDate
Expand Down
3 changes: 3 additions & 0 deletions ebean-api/src/main/java/io/ebean/DatabaseBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ default DatabaseBuilder lazyLoadBatchSize(int lazyLoadBatchSize) {
/**
* @deprecated migrate to {@link #lazyLoadBatchSize(int)}.
*/
@Deprecated
DatabaseBuilder setLazyLoadBatchSize(int lazyLoadBatchSize);

/**
Expand Down Expand Up @@ -371,6 +372,7 @@ default DatabaseBuilder jsonFactory(JsonFactory jsonFactory) {
/**
* @deprecated migrate to {@link #jsonFactory(JsonFactory)}.
*/
@Deprecated
DatabaseBuilder setJsonFactory(JsonFactory jsonFactory);

/**
Expand All @@ -383,6 +385,7 @@ default DatabaseBuilder jsonDateTime(JsonConfig.DateTime jsonDateTime) {
/**
* @deprecated migrate to {@link #jsonDateTime(JsonConfig.DateTime)}.
*/
@Deprecated
DatabaseBuilder setJsonDateTime(JsonConfig.DateTime jsonDateTime);

/**
Expand Down
10 changes: 5 additions & 5 deletions ebean-api/src/main/java/io/ebean/ExpressionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ default OrderBy<T> order() {
* List<String> names =
* DB.find(Customer.class)
* .select("name")
* .order().asc("name")
* .orderBy().asc("name")
* .findSingleAttributeList();
*
* }</pre>
Expand All @@ -368,7 +368,7 @@ default OrderBy<T> order() {
* .setDistinct(true)
* .select("name")
* .where().eq("status", Customer.Status.NEW)
* .order().asc("name")
* .orderBy().asc("name")
* .setMaxRows(100)
* .findSingleAttributeList();
*
Expand Down Expand Up @@ -1713,7 +1713,7 @@ default ExpressionList<T> isIn(String propertyName, Collection<?> values) {
* .eq("status", Customer.Status.ACTIVE)
* .gt("id", 0)
* .endAnd()
* .order().asc("name")
* .orderBy().asc("name")
* .findList();
* }</pre>
*/
Expand All @@ -1734,7 +1734,7 @@ default ExpressionList<T> isIn(String propertyName, Collection<?> values) {
* .or()
* .eq("status", Customer.Status.ACTIVE)
* .isNull("anniversary")
* .order().asc("name")
* .orderBy().asc("name")
* .findList();
*
* }</pre>
Expand All @@ -1754,7 +1754,7 @@ default ExpressionList<T> isIn(String propertyName, Collection<?> values) {
* .eq("status", Customer.Status.ACTIVE)
* .gt("id", 0)
* .endAnd()
* .order().asc("name")
* .orderBy().asc("name")
* .findList();
*
* }</pre>
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/Finder.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* public List<Customer> findNew() {
* return query().where()
* .eq("status", Customer.Status.NEW)
* .order("name")
* .orderBy("name")
* .findList()
* }
* }
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/Junction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion ebean-api/src/main/java/io/ebean/PagedList.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* PagedList<Order> pagedList = DB.find(Order.class)
* .where().eq("status", Order.Status.NEW)
* .order().asc("id")
* .orderBy().asc("id")
* .setFirstRow(0)
* .setMaxRows(50)
* .findPagedList();
Expand Down Expand Up @@ -62,6 +62,7 @@ public interface PagedList<T> {
/**
* Return an empty PagedList.
*/
@SuppressWarnings("removal") // uses internal API
static <B> PagedList<B> emptyList() {
return new EmptyPagedList<>();
}
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/Pairs.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
*
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/QueryIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* Query<Customer> query = database.find(Customer.class)
* .where().gt("id", 0)
* .order("id")
* .orderBy("id")
* .setMaxRows(2);
*
* QueryIterator<Customer> it = query.findIterate();
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/RawSql.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3186,8 +3186,8 @@ public void diff(String prefix, Map<String, ValuePair> map, EntityBean newBean,
* provides unique ordering of the rows (so that the paging is predicable).
*/
public void appendOrderById(SpiQuery<T> 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());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public int delete() {
}

@Override
@SuppressWarnings("removal") // old API
public int delete(Transaction transaction) {
return query.delete(transaction);
}
Expand All @@ -343,6 +344,7 @@ public int update() {
}

@Override
@SuppressWarnings("removal") // old API
public int update(Transaction transaction) {
return query.update(transaction);
}
Expand Down Expand Up @@ -444,6 +446,7 @@ public ExpressionList<T> filterMany(String manyProperty) {
}

@Override
@SuppressWarnings("removal") // old API
public ExpressionList<T> filterMany(String manyProperty, String expressions, Object... params) {
return query.filterMany(manyProperty).where(expressions, params);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void applyRowLimits(SpiQuery<?> query) {
query.setMaxRows(maxRows);
}
if (orderByClause != null) {
query.order(orderByClause);
query.orderBy(orderByClause);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public ExpressionList<T> filterMany(String prop) {
}

@Override
@SuppressWarnings("removal") // old API
public ExpressionList<T> filterMany(String manyProperty, String expressions, Object... params) {
throw new IllegalStateException("filterMany not allowed on Junction expression list");
}
Expand All @@ -338,6 +339,7 @@ public int delete() {
}

@Override
@SuppressWarnings("removal") // old API
public int delete(Transaction transaction) {
return exprList.delete(transaction);
}
Expand All @@ -348,6 +350,7 @@ public int update() {
}

@Override
@SuppressWarnings("removal") // old API
public int update(Transaction transaction) {
return exprList.update(transaction);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ <T> CQueryDraftSupport draftSupport(SpiQuery<T> query) {
<T> CQueryRowCount buildRowCountQuery(OrmQueryRequest<T> request) {
SpiQuery<T> 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public <T> List<Version<T>> findVersions(OrmQueryRequest<T> request) {
}

// order by lower sys period desc
query.order().desc(sysPeriodLower);
query.orderBy().desc(sysPeriodLower);
CQuery<T> cquery = queryBuilder.buildQuery(request);
request.setCancelableQuery(cquery);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand Down Expand Up @@ -446,6 +448,7 @@ public Query<T> orderBy(String orderByClause) {
}

@Override
@SuppressWarnings("removal") // uses internal API
public OrderBy<T> orderBy() {
if (orderBy == null) {
orderBy = new OrderBy<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,7 @@ public final int delete() {
}

@Override
@SuppressWarnings("removal") // old API
public final int delete(Transaction transaction) {
return server.delete(this);
}
Expand All @@ -1492,6 +1493,7 @@ public final int update() {
}

@Override
@SuppressWarnings("removal") // old API
public final int update(Transaction transaction) {
return server.update(this);
}
Expand Down Expand Up @@ -1688,6 +1690,7 @@ public final OrderBy<T> getOrderBy() {
}

@Override
@SuppressWarnings("removal") // uses internal API
public final OrderBy<T> orderBy() {
if (orderBy == null) {
orderBy = new OrderBy<>(this, null);
Expand All @@ -1696,6 +1699,7 @@ public final OrderBy<T> orderBy() {
}

@Override
@SuppressWarnings("removal") // uses internal API
public final Query<T> orderBy(String orderByClause) {
if (orderByClause == null || orderByClause.trim().isEmpty()) {
this.orderBy = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -247,7 +247,7 @@ public void configureBeanQuery(SpiQuery<?> query) {
}

if (orderBy != null) {
query.setOrder(orderBy.copyWithTrim(path));
query.setOrderBy(orderBy.copyWithTrim(path));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,20 @@ 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);
}

@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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ 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;
}

/**
* Order by descending on this property.
*/
public final R desc() {
expr().order().desc(_name);
expr().orderBy().desc(_name);
return _root;
}

Expand Down
Loading