From 3a64cf69522bfa5c4d5e2e40638c5b4cb85d241b Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Mon, 18 Jun 2018 21:34:51 +1200 Subject: [PATCH] #1434 - Remove deprecated API from EbeanServer - finder methods that take explicit transaction. Migrate to use ebeanServer.extended() --- src/main/java/io/ebean/EbeanServer.java | 451 ------------------ .../server/deploy/BeanCollectionHelp.java | 4 +- .../server/deploy/BeanListHelp.java | 4 +- .../server/deploy/BeanMapHelp.java | 4 +- .../server/deploy/BeanPropertyAssocOne.java | 6 +- .../server/deploy/BeanSetHelp.java | 4 +- .../TestFutureRowCountErrorHandling.java | 12 +- .../java/org/tests/basic/TestFetchId.java | 4 +- .../org/tests/basic/TestQueryForUpdate.java | 2 +- .../org/tests/delete/TestDeleteByQuery.java | 6 +- .../query/other/TestQuerySingleAttribute.java | 2 +- .../transaction/TestAutoCommitDataSource.java | 6 +- .../TestExplicitTransactionMode.java | 6 +- 13 files changed, 30 insertions(+), 481 deletions(-) diff --git a/src/main/java/io/ebean/EbeanServer.java b/src/main/java/io/ebean/EbeanServer.java index 36e2612b4..e8d252ec0 100644 --- a/src/main/java/io/ebean/EbeanServer.java +++ b/src/main/java/io/ebean/EbeanServer.java @@ -821,457 +821,6 @@ public interface EbeanServer { */ ExtendedServer extended(); - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Return the number of 'top level' or 'root' entities this query should return. - * - * @see Query#findCount() - * @see Query#findFutureCount() - */ - @Deprecated - int findCount(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Return the Id values of the query as a List. - * - * @see Query#findIds() - */ - @Nonnull - @Deprecated - List findIds(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Return a QueryIterator for the query. - *

- * Generally using {@link #findEach(Query, Consumer, Transaction)} or - * {@link #findEachWhile(Query, Predicate, Transaction)} is preferred - * to findIterate(). The reason is that those methods automatically take care of - * closing the queryIterator (and the underlying jdbc statement and resultSet). - *

- *

- * This is similar to findEach in that not all the result beans need to be held - * in memory at the same time and as such is good for processing large queries. - *

- * - * @see Query#findIterate() - * @see Query#findEach(Consumer) - * @see Query#findEachWhile(Predicate) - */ - @Nonnull - @Deprecated - QueryIterator findIterate(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the query visiting the each bean one at a time. - *

- * Unlike findList() this is suitable for processing a query that will return - * a very large resultSet. The reason is that not all the result beans need to be - * held in memory at the same time and instead processed one at a time. - *

- *

- * Internally this query using a PersistenceContext scoped to each bean (and the - * beans associated object graph). - *

- *

- *

{@code
-   *
-   *     ebeanServer.find(Order.class)
-   *       .where().eq("status", Order.Status.NEW)
-   *       .order().asc("id")
-   *       .findEach((Order order) -> {
-   *
-   *         // do something with the order bean
-   *         System.out.println(" -- processing order ... " + order);
-   *       });
-   *
-   * }
- * - * @see Query#findEach(Consumer) - * @see Query#findEachWhile(Predicate) - */ - @Deprecated - void findEach(Query query, Consumer consumer, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the query visiting the each bean one at a time. - *

- * Compared to findEach() this provides the ability to stop processing the query - * results early by returning false for the Predicate. - *

- *

- * Unlike findList() this is suitable for processing a query that will return - * a very large resultSet. The reason is that not all the result beans need to be - * held in memory at the same time and instead processed one at a time. - *

- *

- * Internally this query using a PersistenceContext scoped to each bean (and the - * beans associated object graph). - *

- *

- *

{@code
-   *
-   *     ebeanServer.find(Order.class)
-   *       .where().eq("status", Order.Status.NEW)
-   *       .order().asc("id")
-   *       .findEachWhile((Order order) -> {
-   *
-   *         // do something with the order bean
-   *         System.out.println(" -- processing order ... " + order);
-   *
-   *         boolean carryOnProcessing = ...
-   *         return carryOnProcessing;
-   *       });
-   *
-   * }
- * - * @see Query#findEach(Consumer) - * @see Query#findEachWhile(Predicate) - */ - @Deprecated - void findEachWhile(Query query, Predicate consumer, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Return versions of a @History entity bean. - *

- * Generally this query is expected to be a find by id or unique predicates query. - * It will execute the query against the history returning the versions of the bean. - *

- */ - @Nonnull - @Deprecated - List> findVersions(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute a query returning a list of beans. - *

- * Generally you are able to use {@link Query#findList()} rather than - * explicitly calling this method. You could use this method if you wish to - * explicitly control the transaction used for the query. - *

- *

- *

{@code
-   *
-   * List customers =
-   *     ebeanServer.find(Customer.class)
-   *     .where().ilike("name", "rob%")
-   *     .findList();
-   *
-   * }
- * - * @param the type of entity bean to fetch. - * @param query the query to execute. - * @param transaction the transaction to use (can be null). - * @return the list of fetched beans. - * @see Query#findList() - */ - @Nonnull - @Deprecated - List findList(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute find row count query in a background thread. - *

- * This returns a Future object which can be used to cancel, check the - * execution status (isDone etc) and get the value (with or without a - * timeout). - *

- * - * @param query the query to execute the row count on - * @param transaction the transaction (can be null). - * @return a Future object for the row count query - * @see Query#findFutureCount() - */ - @Nonnull - @Deprecated - FutureRowCount findFutureCount(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute find Id's query in a background thread. - *

- * This returns a Future object which can be used to cancel, check the - * execution status (isDone etc) and get the value (with or without a - * timeout). - *

- * - * @param query the query to execute the fetch Id's on - * @param transaction the transaction (can be null). - * @return a Future object for the list of Id's - * @see Query#findFutureIds() - */ - @Nonnull - @Deprecated - FutureIds findFutureIds(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute find list query in a background thread returning a FutureList object. - *

- * This returns a Future object which can be used to cancel, check the - * execution status (isDone etc) and get the value (with or without a timeout). - *

- * This query will execute in it's own PersistenceContext and using its own transaction. - * What that means is that it will not share any bean instances with other queries. - * - * @param query the query to execute in the background - * @param transaction the transaction (can be null). - * @return a Future object for the list result of the query - * @see Query#findFutureList() - */ - @Nonnull - @Deprecated - FutureList findFutureList(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Return a PagedList for this query using firstRow and maxRows. - *

- * The benefit of using this over findList() is that it provides functionality to get the - * total row count etc. - *

- *

- * If maxRows is not set on the query prior to calling findPagedList() then a - * PersistenceException is thrown. - *

- *

- *

{@code
-   *
-   *  PagedList pagedList = Ebean.find(Order.class)
-   *       .setFirstRow(50)
-   *       .setMaxRows(20)
-   *       .findPagedList();
-   *
-   *       // fetch the total row count in the background
-   *       pagedList.loadRowCount();
-   *
-   *       List orders = pagedList.getList();
-   *       int totalRowCount = pagedList.getTotalRowCount();
-   *
-   * }
- * - * @return The PagedList - * @see Query#findPagedList() - */ - @Nonnull - @Deprecated - PagedList findPagedList(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the query returning a set of entity beans. - *

- * Generally you are able to use {@link Query#findSet()} rather than - * explicitly calling this method. You could use this method if you wish to - * explicitly control the transaction used for the query. - *

- *

- *

{@code
-   *
-   * Set customers =
-   *     ebeanServer.find(Customer.class)
-   *     .where().ilike("name", "rob%")
-   *     .findSet();
-   *
-   * }
- * - * @param the type of entity bean to fetch. - * @param query the query to execute - * @param transaction the transaction to use (can be null). - * @return the set of fetched beans. - * @see Query#findSet() - */ - @Nonnull - @Deprecated - Set findSet(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the query returning the entity beans in a Map. - *

- * Generally you are able to use {@link Query#findMap()} rather than - * explicitly calling this method. You could use this method if you wish to - * explicitly control the transaction used for the query. - *

- * - * @param the type of entity bean to fetch. - * @param query the query to execute. - * @param transaction the transaction to use (can be null). - * @return the map of fetched beans. - * @see Query#findMap() - */ - @Nonnull - @Deprecated - Map findMap(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the query returning a list of values for a single property. - *

- *

Example 1:

- *
{@code
-   *
-   *  List names =
-   *    Ebean.find(Customer.class)
-   *      .select("name")
-   *      .orderBy().asc("name")
-   *      .findSingleAttributeList();
-   *
-   * }
- *

Example 2:

- *
{@code
-   *
-   *  List names =
-   *    Ebean.find(Customer.class)
-   *      .setDistinct(true)
-   *      .select("name")
-   *      .where().eq("status", Customer.Status.NEW)
-   *      .orderBy().asc("name")
-   *      .setMaxRows(100)
-   *      .findSingleAttributeList();
-   *
-   * }
- * - * @return the list of values for the selected property - * @see Query#findSingleAttributeList() - */ - @Nonnull - @Deprecated - List
findSingleAttributeList(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the query returning at most one entity bean or null (if no matching - * bean is found). - *

- * This will throw a NonUniqueResultException if the query finds more than one result. - *

- *

- * Generally you are able to use {@link Query#findOne()} rather than - * explicitly calling this method. You could use this method if you wish to - * explicitly control the transaction used for the query. - *

- * - * @param the type of entity bean to fetch. - * @param query the query to execute. - * @param transaction the transaction to use (can be null). - * @return the list of fetched beans. - * @throws NonUniqueResultException if more than one result was found - * @see Query#findOne() - */ - @Nullable - @Deprecated - T findOne(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Similar to findOne() but returns an Optional (rather than nullable). - */ - @Nonnull - @Deprecated - Optional findOneOrEmpty(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute as a delete query deleting the 'root level' beans that match the predicates - * in the query. - *

- * Note that if the query includes joins then the generated delete statement may not be - * optimal depending on the database platform. - *

- * - * @param query the query used for the delete - * @param transaction the transaction to use (can be null) - * @param the type of entity bean to fetch. - * @return the number of beans/rows that were deleted - */ - @Deprecated - int delete(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the update query returning the number of rows updated. - *

- * The update query must be created using {@link #update(Class)}. - *

- * - * @param query the update query to execute - * @param transaction the optional transaction to use for the update (can be null) - * @param the type of entity bean - * @return The number of rows updated - */ - @Deprecated - int update(Query query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the sql query returning a list of MapBean. - *

- * Generally you are able to use {@link SqlQuery#findList()} rather than - * explicitly calling this method. You could use this method if you wish to - * explicitly control the transaction used for the query. - *

- * - * @param query the query to execute. - * @param transaction the transaction to use (can be null). - * @return the list of fetched MapBean. - * @see SqlQuery#findList() - */ - @Nonnull - @Deprecated - List findList(SqlQuery query, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the SqlQuery iterating a row at a time. - *

- * This streaming type query is useful for large query execution as only 1 row needs to be held in memory. - *

- */ - @Deprecated - void findEach(SqlQuery query, Consumer consumer, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the SqlQuery iterating a row at a time with the ability to stop consuming part way through. - *

- * Returning false after processing a row stops the iteration through the query results. - *

- *

- * This streaming type query is useful for large query execution as only 1 row needs to be held in memory. - *

- */ - @Deprecated - void findEachWhile(SqlQuery query, Predicate consumer, Transaction transaction); - - /** - * Deprecated - Moved to the ExtendedServer API, please use via extended(). - * Execute the sql query returning a single MapBean or null. - *

- * This will throw a PersistenceException if the query found more than one - * result. - *

- *

- * Generally you are able to use {@link SqlQuery#findOne()} rather than - * explicitly calling this method. You could use this method if you wish to - * explicitly control the transaction used for the query. - *

- * - * @param query the query to execute. - * @param transaction the transaction to use (can be null). - * @return the fetched MapBean or null if none was found. - * @see SqlQuery#findOne() - */ - @Nullable - @Deprecated - SqlRow findOne(SqlQuery query, Transaction transaction); - /** * Either Insert or Update the bean depending on its state. *

diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanCollectionHelp.java b/src/main/java/io/ebeaninternal/server/deploy/BeanCollectionHelp.java index ede034939..308284040 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanCollectionHelp.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanCollectionHelp.java @@ -1,12 +1,12 @@ package io.ebeaninternal.server.deploy; -import io.ebean.EbeanServer; import io.ebean.Query; import io.ebean.Transaction; import io.ebean.bean.BeanCollection; import io.ebean.bean.BeanCollectionAdd; import io.ebean.bean.BeanCollectionLoader; import io.ebean.bean.EntityBean; +import io.ebeaninternal.api.SpiEbeanServer; import io.ebeaninternal.api.json.SpiJsonWriter; import io.ebeaninternal.server.query.CQueryCollectionAdd; @@ -59,7 +59,7 @@ public interface BeanCollectionHelp extends CQueryCollectionAdd { /** * Refresh the List Set or Map. */ - void refresh(EbeanServer server, Query query, Transaction t, EntityBean parentBean); + void refresh(SpiEbeanServer server, Query query, Transaction t, EntityBean parentBean); /** * Apply the new refreshed BeanCollection to the appropriate property of the parent bean. diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanListHelp.java b/src/main/java/io/ebeaninternal/server/deploy/BeanListHelp.java index 9b751a16e..64cd91494 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanListHelp.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanListHelp.java @@ -1,12 +1,12 @@ package io.ebeaninternal.server.deploy; -import io.ebean.EbeanServer; import io.ebean.Query; import io.ebean.Transaction; import io.ebean.bean.BeanCollection; import io.ebean.bean.BeanCollectionAdd; import io.ebean.bean.EntityBean; import io.ebean.common.BeanList; +import io.ebeaninternal.api.SpiEbeanServer; import io.ebeaninternal.api.json.SpiJsonWriter; import java.io.IOException; @@ -64,7 +64,7 @@ public class BeanListHelp extends BaseCollectionHelp { } @Override - public void refresh(EbeanServer server, Query query, Transaction t, EntityBean parentBean) { + public void refresh(SpiEbeanServer server, Query query, Transaction t, EntityBean parentBean) { BeanList newBeanList = (BeanList) server.findList(query, t); refresh(newBeanList, parentBean); diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanMapHelp.java b/src/main/java/io/ebeaninternal/server/deploy/BeanMapHelp.java index 72feb6d80..14440a26f 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanMapHelp.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanMapHelp.java @@ -1,12 +1,12 @@ package io.ebeaninternal.server.deploy; -import io.ebean.EbeanServer; import io.ebean.Query; import io.ebean.Transaction; import io.ebean.bean.BeanCollection; import io.ebean.bean.BeanCollectionAdd; import io.ebean.bean.EntityBean; import io.ebean.common.BeanMap; +import io.ebeaninternal.api.SpiEbeanServer; import io.ebeaninternal.api.json.SpiJsonWriter; import java.io.IOException; @@ -124,7 +124,7 @@ public class BeanMapHelp extends BaseCollectionHelp { } @Override - public void refresh(EbeanServer server, Query query, Transaction t, EntityBean parentBean) { + public void refresh(SpiEbeanServer server, Query query, Transaction t, EntityBean parentBean) { BeanMap newBeanMap = (BeanMap) server.findMap(query, t); refresh(newBeanMap, parentBean); } diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocOne.java b/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocOne.java index d29e12946..502a4bab1 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocOne.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocOne.java @@ -1,6 +1,5 @@ package io.ebeaninternal.server.deploy; -import io.ebean.EbeanServer; import io.ebean.Query; import io.ebean.SqlUpdate; import io.ebean.Transaction; @@ -8,6 +7,7 @@ import io.ebean.ValuePair; import io.ebean.bean.EntityBean; import io.ebean.bean.PersistenceContext; import io.ebean.util.SplitName; +import io.ebeaninternal.api.SpiEbeanServer; import io.ebeaninternal.api.SpiQuery; import io.ebeaninternal.api.json.SpiJsonReader; import io.ebeaninternal.api.json.SpiJsonWriter; @@ -238,7 +238,7 @@ public class BeanPropertyAssocOne extends BeanPropertyAssoc implements STr String rawWhere = deriveWhereParentIdSql(false); - EbeanServer server = server(); + SpiEbeanServer server = server(); Query q = server.find(getPropertyType()); bindParentIdEq(rawWhere, parentId, q); return server.findIds(q, t); @@ -250,7 +250,7 @@ public class BeanPropertyAssocOne extends BeanPropertyAssoc implements STr String inClause = targetIdBinder.getIdInValueExpr(false, parentIds.size()); String expr = rawWhere + inClause; - EbeanServer server = server(); + SpiEbeanServer server = server(); Query q = server.find(getPropertyType()); bindParentIdsIn(expr, parentIds, q); diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanSetHelp.java b/src/main/java/io/ebeaninternal/server/deploy/BeanSetHelp.java index 482ccce62..4acc23347 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanSetHelp.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanSetHelp.java @@ -1,12 +1,12 @@ package io.ebeaninternal.server.deploy; -import io.ebean.EbeanServer; import io.ebean.Query; import io.ebean.Transaction; import io.ebean.bean.BeanCollection; import io.ebean.bean.BeanCollectionAdd; import io.ebean.bean.EntityBean; import io.ebean.common.BeanSet; +import io.ebeaninternal.api.SpiEbeanServer; import io.ebeaninternal.api.json.SpiJsonWriter; import java.io.IOException; @@ -69,7 +69,7 @@ public class BeanSetHelp extends BaseCollectionHelp { } @Override - public void refresh(EbeanServer server, Query query, Transaction t, EntityBean parentBean) { + public void refresh(SpiEbeanServer server, Query query, Transaction t, EntityBean parentBean) { BeanSet newBeanSet = (BeanSet) server.findSet(query, t); refresh(newBeanSet, parentBean); diff --git a/src/test/java/io/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java b/src/test/java/io/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java index d95e46fca..1e9bf307d 100644 --- a/src/test/java/io/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java +++ b/src/test/java/io/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java @@ -22,13 +22,13 @@ public class TestFutureRowCountErrorHandling extends BaseTestCase { ResetBasicData.reset(); - EbeanServer server = Ebean.getServer(null); + EbeanServer server = Ebean.getDefaultServer(); Query query = server.createQuery(Customer.class) .where().eq("doesNotExist", "this will fail") .query(); - FutureRowCount futureRowCount = server.findFutureCount(query, null); + FutureRowCount futureRowCount = query.findFutureCount(); QueryFutureRowCount internalRowCount = (QueryFutureRowCount) futureRowCount; Transaction t = internalRowCount.getTransaction(); @@ -49,13 +49,13 @@ public class TestFutureRowCountErrorHandling extends BaseTestCase { ResetBasicData.reset(); - EbeanServer server = Ebean.getServer(null); + EbeanServer server = Ebean.getDefaultServer(); Query query = server.createQuery(Customer.class) .where().eq("doesNotExist", "this will fail") .query(); - FutureIds futureIds = server.findFutureIds(query, null); + FutureIds futureIds = query.findFutureIds(); QueryFutureIds internalFuture = (QueryFutureIds) futureIds; Transaction t = internalFuture.getTransaction(); @@ -77,13 +77,13 @@ public class TestFutureRowCountErrorHandling extends BaseTestCase { ResetBasicData.reset(); - EbeanServer server = Ebean.getServer(null); + EbeanServer server = Ebean.getDefaultServer(); Query query = server.createQuery(Customer.class) .where().eq("doesNotExist", "this will fail") .query(); - FutureList futureList = server.findFutureList(query, null); + FutureList futureList = query.findFutureList(); QueryFutureList internalFuture = (QueryFutureList) futureList; Transaction t = internalFuture.getTransaction(); diff --git a/src/test/java/org/tests/basic/TestFetchId.java b/src/test/java/org/tests/basic/TestFetchId.java index 68993e7d1..cf207995c 100644 --- a/src/test/java/org/tests/basic/TestFetchId.java +++ b/src/test/java/org/tests/basic/TestFetchId.java @@ -27,10 +27,10 @@ public class TestFetchId extends BaseTestCase { .gt("details.id", 0) .query(); - List ids = Ebean.getServer(null).findIds(query, null); + List ids = query.findIds(); assertThat(ids).isNotEmpty(); - FutureIds futureIds = Ebean.getServer(null).findFutureIds(query, null); + FutureIds futureIds = query.findFutureIds(); // wait for all the id's to be fetched List idList = futureIds.get(); diff --git a/src/test/java/org/tests/basic/TestQueryForUpdate.java b/src/test/java/org/tests/basic/TestQueryForUpdate.java index 54f339ffc..f5013e77e 100644 --- a/src/test/java/org/tests/basic/TestQueryForUpdate.java +++ b/src/test/java/org/tests/basic/TestQueryForUpdate.java @@ -136,7 +136,7 @@ public class TestQueryForUpdate extends BaseTestCase { .where().idEq(first.getId()) .forUpdateNoWait(); - server.findOne(query2, txn2); + server.extended().findOne(query2, txn2); assertTrue(false); // never get here } catch (AcquireLockException e) { logger.info("... got AcquireLockException " + e); diff --git a/src/test/java/org/tests/delete/TestDeleteByQuery.java b/src/test/java/org/tests/delete/TestDeleteByQuery.java index 89dd04c72..a4b7ce989 100644 --- a/src/test/java/org/tests/delete/TestDeleteByQuery.java +++ b/src/test/java/org/tests/delete/TestDeleteByQuery.java @@ -29,7 +29,7 @@ public class TestDeleteByQuery extends BaseTestCase { Query query = server.find(Contact.class).where().eq("group.name", "NahYeahMaybe").query(); LoggedSqlCollector.start(); - server.delete(query, null); + query.delete(); List loggedSql = LoggedSqlCollector.stop(); assertThat(loggedSql).hasSize(1); @@ -38,7 +38,7 @@ public class TestDeleteByQuery extends BaseTestCase { Query query2 = server.find(Contact.class).where().eq("firstName", "NotARealFirstName").query(); LoggedSqlCollector.start(); - server.delete(query2, null); + query2.delete(); loggedSql = LoggedSqlCollector.stop(); assertThat(loggedSql).hasSize(1); @@ -75,7 +75,7 @@ public class TestDeleteByQuery extends BaseTestCase { Ebean.find(Customer.class) .where().eq("name", "Don Roberto") - .query().setForUpdate(true) + .query().forUpdate() .delete(); List sql = LoggedSqlCollector.stop(); diff --git a/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java b/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java index ff482a03e..b985a2a0a 100644 --- a/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java +++ b/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java @@ -321,7 +321,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { Query query = Ebean.find(EUncle.class) .fetch("parent", "more"); - Ebean.getDefaultServer().findSingleAttributeList(query, null); + query.findSingleAttributeList(); assertThat(sqlOf(query)).contains("select t1.more from rawinherit_uncle t0 join rawinherit_parent t1 on t1.id = t0.parent_id"); } diff --git a/src/test/java/org/tests/transaction/TestAutoCommitDataSource.java b/src/test/java/org/tests/transaction/TestAutoCommitDataSource.java index 19db621d5..554b2efd7 100644 --- a/src/test/java/org/tests/transaction/TestAutoCommitDataSource.java +++ b/src/test/java/org/tests/transaction/TestAutoCommitDataSource.java @@ -60,7 +60,7 @@ public class TestAutoCommitDataSource extends BaseTestCase { EbeanServer ebeanServer = EbeanServerFactory.create(config); Query query = ebeanServer.find(UTMaster.class); - List details = ebeanServer.findList(query, null); + List details = query.findList(); assertEquals(0, details.size()); UTMaster bean1 = new UTMaster("one1"); @@ -77,7 +77,7 @@ public class TestAutoCommitDataSource extends BaseTestCase { ebeanServer.save(bean2); Query query2 = ebeanServer.find(UTMaster.class); - details = ebeanServer.findList(query2, otherTxn); + details = ebeanServer.extended().findList(query2, otherTxn); assertEquals(2, details.size()); ebeanServer.save(bean3); @@ -89,7 +89,7 @@ public class TestAutoCommitDataSource extends BaseTestCase { } Query query3 = ebeanServer.find(UTMaster.class); - details = ebeanServer.findList(query3, otherTxn); + details = ebeanServer.extended().findList(query3, otherTxn); assertEquals(3, details.size()); } diff --git a/src/test/java/org/tests/transaction/TestExplicitTransactionMode.java b/src/test/java/org/tests/transaction/TestExplicitTransactionMode.java index e7614619b..0809baa9c 100644 --- a/src/test/java/org/tests/transaction/TestExplicitTransactionMode.java +++ b/src/test/java/org/tests/transaction/TestExplicitTransactionMode.java @@ -62,7 +62,7 @@ public class TestExplicitTransactionMode extends BaseTestCase { System.clearProperty("ebean.ignoreExtraDdl"); Query query = ebeanServer.find(UTMaster.class); - List details = ebeanServer.findList(query, null); + List details = query.findList(); assertEquals(0, details.size()); UTMaster bean0 = new UTMaster("one0"); @@ -91,7 +91,7 @@ public class TestExplicitTransactionMode extends BaseTestCase { // not visible in other transaction Query query2 = ebeanServer.find(UTMaster.class); - details = ebeanServer.findList(query2, otherTxn); + details = ebeanServer.extended().findList(query2, otherTxn); assertEquals(0, details.size()); ebeanServer.save(bean3); @@ -104,7 +104,7 @@ public class TestExplicitTransactionMode extends BaseTestCase { // commit as expected Query query3 = ebeanServer.find(UTMaster.class); - details = ebeanServer.findList(query3, otherTxn); + details = ebeanServer.extended().findList(query3, otherTxn); assertEquals(3, details.size()); } }