diff --git a/src/main/java/com/avaje/ebean/EbeanServer.java b/src/main/java/com/avaje/ebean/EbeanServer.java index fc82a2fa7..93f1af715 100644 --- a/src/main/java/com/avaje/ebean/EbeanServer.java +++ b/src/main/java/com/avaje/ebean/EbeanServer.java @@ -741,8 +741,8 @@ public interface EbeanServer { /** * Return the number of 'top level' or 'root' entities this query should return. * - * @see Query#findRowCount() - * @see com.avaje.ebean.Query#findFutureRowCount() + * @see Query#findCount() + * @see Query#findFutureCount() */ int findCount(Query query, Transaction transaction); diff --git a/src/main/java/com/avaje/ebean/ExpressionList.java b/src/main/java/com/avaje/ebean/ExpressionList.java index 34f4c441a..cd7cf962d 100644 --- a/src/main/java/com/avaje/ebean/ExpressionList.java +++ b/src/main/java/com/avaje/ebean/ExpressionList.java @@ -182,6 +182,13 @@ public interface ExpressionList { * This is the number of 'top level' or 'root level' entities. *

*/ + int findCount(); + + /** + * Deprecated in favor of findCount(). + * + * @deprecated + */ int findRowCount(); /** @@ -228,6 +235,13 @@ public interface ExpressionList { * * @return a Future object for the row count query */ + FutureRowCount findFutureCount(); + + /** + * Deprecated in favor of findFutureCount(). + * + * @deprecated + */ FutureRowCount findFutureRowCount(); /** diff --git a/src/main/java/com/avaje/ebean/Model.java b/src/main/java/com/avaje/ebean/Model.java index ab87eb41d..edf0572e1 100644 --- a/src/main/java/com/avaje/ebean/Model.java +++ b/src/main/java/com/avaje/ebean/Model.java @@ -677,19 +677,36 @@ public abstract class Model { /** * Executes a find row count query in a background thread. *

- * Equivalent to {@link Query#findFutureRowCount()} + * Equivalent to {@link Query#findFutureCount()} + */ + public FutureRowCount findFutureCount() { + return query().findFutureCount(); + } + + /** + * Deprecated in favor of findFutureCount(). + *

+ * Equivalent to {@link Query#findFutureCount()} */ public FutureRowCount findFutureRowCount() { - return query().findFutureRowCount(); + return query().findFutureCount(); } /** * Returns the total number of entities for this type. * *

- * Equivalent to {@link Query#findRowCount()} + * Equivalent to {@link Query#findCount()} + */ + public int findCount() { + return query().findCount(); + } + + /** + * Deprecated in favor of findCount(). + * @deprecated */ public int findRowCount() { - return query().findRowCount(); + return query().findCount(); } /** diff --git a/src/main/java/com/avaje/ebean/PagedList.java b/src/main/java/com/avaje/ebean/PagedList.java index 22347967d..9efb6a830 100644 --- a/src/main/java/com/avaje/ebean/PagedList.java +++ b/src/main/java/com/avaje/ebean/PagedList.java @@ -110,6 +110,13 @@ public interface PagedList { * wrapped in the unchecked PersistenceException (which might be preferrable). *

*/ + void loadCount(); + + /** + * Deprecated in favor of loadCount(). + * + * @deprecated + */ void loadRowCount(); /** @@ -138,6 +145,13 @@ public interface PagedList { * * } */ + Future getFutureCount(); + + /** + * Deprecated in favor of getFutureCount(). + * + * @deprecated + */ Future getFutureRowCount(); /** @@ -170,6 +184,13 @@ public interface PagedList { * * } */ + int getTotalCount(); + + /** + * Deprecated in favor of getTotalCount(). + * + * @deprecated + */ int getTotalRowCount(); /** diff --git a/src/main/java/com/avaje/ebeaninternal/server/expression/DefaultExpressionList.java b/src/main/java/com/avaje/ebeaninternal/server/expression/DefaultExpressionList.java index a6cd1001d..1d84c4029 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/expression/DefaultExpressionList.java +++ b/src/main/java/com/avaje/ebeaninternal/server/expression/DefaultExpressionList.java @@ -323,9 +323,14 @@ public class DefaultExpressionList implements SpiExpressionList { return query.findFutureIds(); } + @Override + public FutureRowCount findFutureCount() { + return query.findFutureCount(); + } + @Override public FutureRowCount findFutureRowCount() { - return query.findFutureRowCount(); + return findFutureCount(); } @Override @@ -338,9 +343,14 @@ public class DefaultExpressionList implements SpiExpressionList { return query.findPagedList(); } + @Override + public int findCount() { + return query.findCount(); + } + @Override public int findRowCount() { - return query.findRowCount(); + return findCount(); } @Override diff --git a/src/main/java/com/avaje/ebeaninternal/server/expression/FilterExpressionList.java b/src/main/java/com/avaje/ebeaninternal/server/expression/FilterExpressionList.java index 91ffc2406..18284b842 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/expression/FilterExpressionList.java +++ b/src/main/java/com/avaje/ebeaninternal/server/expression/FilterExpressionList.java @@ -48,9 +48,14 @@ public class FilterExpressionList extends DefaultExpressionList { return rootQuery.findFutureList(); } + @Override + public FutureRowCount findFutureCount() { + return rootQuery.findFutureCount(); + } + @Override public FutureRowCount findFutureRowCount() { - return rootQuery.findFutureRowCount(); + return findFutureCount(); } @Override @@ -63,9 +68,14 @@ public class FilterExpressionList extends DefaultExpressionList { return rootQuery.findMap(); } + @Override + public int findCount() { + return rootQuery.findCount(); + } + @Override public int findRowCount() { - return rootQuery.findRowCount(); + return findCount(); } @Override diff --git a/src/main/java/com/avaje/ebeaninternal/server/expression/JunctionExpression.java b/src/main/java/com/avaje/ebeaninternal/server/expression/JunctionExpression.java index 6b49e2492..e6bb77918 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/expression/JunctionExpression.java +++ b/src/main/java/com/avaje/ebeaninternal/server/expression/JunctionExpression.java @@ -360,9 +360,14 @@ class JunctionExpression implements SpiJunction, SpiExpression, Expression return exprList.findFutureList(); } + @Override + public FutureRowCount findFutureCount() { + return exprList.findFutureCount(); + } + @Override public FutureRowCount findFutureRowCount() { - return exprList.findFutureRowCount(); + return findFutureCount(); } @Override @@ -401,10 +406,15 @@ class JunctionExpression implements SpiJunction, SpiExpression, Expression } @Override - public int findRowCount() { + public int findCount() { return exprList.findRowCount(); } + @Override + public int findRowCount() { + return findCount(); + } + @Override public Set findSet() { return exprList.findSet(); diff --git a/src/main/java/com/avaje/ebeaninternal/server/query/LimitOffsetPagedList.java b/src/main/java/com/avaje/ebeaninternal/server/query/LimitOffsetPagedList.java index 9906ac223..eb5ef408c 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/query/LimitOffsetPagedList.java +++ b/src/main/java/com/avaje/ebeaninternal/server/query/LimitOffsetPagedList.java @@ -43,19 +43,27 @@ public class LimitOffsetPagedList implements PagedList { this.firstRow = query.getFirstRow(); } - public void loadRowCount() { - getFutureRowCount(); + public void loadCount() { + getFutureCount(); } - public Future getFutureRowCount() { + public void loadRowCount() { + loadCount(); + } + + public Future getFutureCount() { synchronized (monitor) { if (futureRowCount == null) { - futureRowCount = server.findFutureRowCount(query, null); + futureRowCount = server.findFutureCount(query, null); } return futureRowCount; } } + public Future getFutureRowCount() { + return getFutureCount(); + } + public List getList() { synchronized (monitor) { if (list == null) { @@ -67,7 +75,7 @@ public class LimitOffsetPagedList implements PagedList { public int getTotalPageCount() { - int rowCount = getTotalRowCount(); + int rowCount = getTotalCount(); if (rowCount == 0) { return 0; } else { @@ -75,7 +83,7 @@ public class LimitOffsetPagedList implements PagedList { } } - public int getTotalRowCount() { + public int getTotalCount() { synchronized (monitor) { if (futureRowCount != null) { try { @@ -89,13 +97,17 @@ public class LimitOffsetPagedList implements PagedList { if (foregroundTotalRowCount > -1) return foregroundTotalRowCount; // just using foreground thread - foregroundTotalRowCount = server.findRowCount(query, null); + foregroundTotalRowCount = server.findCount(query, null); return foregroundTotalRowCount; } } + public int getTotalRowCount() { + return getTotalCount(); + } + public boolean hasNext() { - return (firstRow + maxRows) < getTotalRowCount(); + return (firstRow + maxRows) < getTotalCount(); } public boolean hasPrev() { @@ -110,7 +122,7 @@ public class LimitOffsetPagedList implements PagedList { int first = firstRow + 1; int last = firstRow + getList().size(); - int total = getTotalRowCount(); + int total = getTotalCount(); return first + to + last + of + total; } diff --git a/src/test/java/com/avaje/ebeaninternal/server/lib/sql/TestDataSourceMaxWithEntity.java b/src/test/java/com/avaje/ebeaninternal/server/lib/sql/TestDataSourceMaxWithEntity.java index 8abda7611..ad97b3b5e 100644 --- a/src/test/java/com/avaje/ebeaninternal/server/lib/sql/TestDataSourceMaxWithEntity.java +++ b/src/test/java/com/avaje/ebeaninternal/server/lib/sql/TestDataSourceMaxWithEntity.java @@ -54,7 +54,7 @@ public class TestDataSourceMaxWithEntity extends BaseTestCase { public void run() { - server.find(Customer.class).findRowCount(); + server.find(Customer.class).findCount(); try { System.out.println(position+" sleep " + sleepMillis); Thread.sleep(sleepMillis); diff --git a/src/test/java/com/avaje/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java b/src/test/java/com/avaje/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java index 278466bec..233bd873b 100644 --- a/src/test/java/com/avaje/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java +++ b/src/test/java/com/avaje/ebeaninternal/server/query/TestFutureRowCountErrorHandling.java @@ -29,7 +29,7 @@ public class TestFutureRowCountErrorHandling extends BaseTestCase { .where().eq("doesNotExist", "this will fail") .query(); - FutureRowCount futureRowCount = server.findFutureRowCount(query, null); + FutureRowCount futureRowCount = server.findFutureCount(query, null); QueryFutureRowCount internalRowCount = (QueryFutureRowCount)futureRowCount; Transaction t = internalRowCount.getTransaction(); diff --git a/src/test/java/com/avaje/tests/basic/MainDbBoolean.java b/src/test/java/com/avaje/tests/basic/MainDbBoolean.java index a4929a481..e3c2ab758 100644 --- a/src/test/java/com/avaje/tests/basic/MainDbBoolean.java +++ b/src/test/java/com/avaje/tests/basic/MainDbBoolean.java @@ -147,7 +147,7 @@ public class MainDbBoolean { .setAutoTune(false) .order("id"); - int rc = query.findRowCount(); + int rc = query.findCount(); Assert.assertTrue(rc > 0); diff --git a/src/test/java/com/avaje/tests/draftable/LinkQueryPublishTest.java b/src/test/java/com/avaje/tests/draftable/LinkQueryPublishTest.java index 03d885b35..762068b91 100644 --- a/src/test/java/com/avaje/tests/draftable/LinkQueryPublishTest.java +++ b/src/test/java/com/avaje/tests/draftable/LinkQueryPublishTest.java @@ -39,7 +39,7 @@ public class LinkQueryPublishTest { .setMaxRows(10) .findPagedList(); - assertThat(pagedList.getTotalRowCount()).isEqualTo(3); + assertThat(pagedList.getTotalCount()).isEqualTo(3); assertThat(pagedList.getList()).hasSize(3); diff --git a/src/test/java/com/avaje/tests/m2m/TestM2MDeleteWithCascade.java b/src/test/java/com/avaje/tests/m2m/TestM2MDeleteWithCascade.java index ca13a9710..6525886ba 100644 --- a/src/test/java/com/avaje/tests/m2m/TestM2MDeleteWithCascade.java +++ b/src/test/java/com/avaje/tests/m2m/TestM2MDeleteWithCascade.java @@ -39,13 +39,13 @@ public class TestM2MDeleteWithCascade extends BaseTestCase { List roleIds = new ArrayList(); Collections.addAll(roleIds, r0.getRoleid(), r1.getRoleid()); - int rc = Ebean.find(MRole.class).where().idIn(roleIds).findRowCount(); + int rc = Ebean.find(MRole.class).where().idIn(roleIds).findCount(); Assert.assertEquals("roles not deleted", 2, rc); Ebean.deleteAll(roles); - rc = Ebean.find(MRole.class).where().idIn(roleIds).findRowCount(); + rc = Ebean.find(MRole.class).where().idIn(roleIds).findCount(); Assert.assertEquals("roles deleted now", 0, rc); } diff --git a/src/test/java/com/avaje/tests/model/basic/ResetBasicData.java b/src/test/java/com/avaje/tests/model/basic/ResetBasicData.java index db13c5fee..b4d3bd35d 100644 --- a/src/test/java/com/avaje/tests/model/basic/ResetBasicData.java +++ b/src/test/java/com/avaje/tests/model/basic/ResetBasicData.java @@ -25,7 +25,7 @@ public class ResetBasicData { server.execute(new TxRunnable() { public void run() { - if (server.find(Product.class).findRowCount() > 0) { + if (server.find(Product.class).findCount() > 0) { // we can't really delete this base data as // the test rely on the products being in there return; @@ -72,7 +72,7 @@ public class ResetBasicData { public void insertCountries() { - if (server.find(Country.class).findRowCount() > 0) { + if (server.find(Country.class).findCount() > 0) { return; } @@ -94,7 +94,7 @@ public class ResetBasicData { public void insertProducts() { - if (server.find(Product.class).findRowCount() > 0) { + if (server.find(Product.class).findCount() > 0) { return; } server.execute(new TxRunnable() { diff --git a/src/test/java/com/avaje/tests/model/noid/TestInsertNoIdBean.java b/src/test/java/com/avaje/tests/model/noid/TestInsertNoIdBean.java index 18ff9e86d..af954a29e 100644 --- a/src/test/java/com/avaje/tests/model/noid/TestInsertNoIdBean.java +++ b/src/test/java/com/avaje/tests/model/noid/TestInsertNoIdBean.java @@ -18,7 +18,7 @@ public class TestInsertNoIdBean extends BaseTestCase { Ebean.save(bean); - int rowCount = Ebean.find(NoIdBean.class).findRowCount(); + int rowCount = Ebean.find(NoIdBean.class).findCount(); assertTrue("rowCount:"+rowCount, rowCount > 0); diff --git a/src/test/java/com/avaje/tests/model/selfref/TestTextJsonSelfRef.java b/src/test/java/com/avaje/tests/model/selfref/TestTextJsonSelfRef.java index 2e33211b7..4c928bbf7 100644 --- a/src/test/java/com/avaje/tests/model/selfref/TestTextJsonSelfRef.java +++ b/src/test/java/com/avaje/tests/model/selfref/TestTextJsonSelfRef.java @@ -18,7 +18,7 @@ public class TestTextJsonSelfRef extends BaseTestCase { Ebean.execute(new TxRunnable() { public void run() { - if (Ebean.find(SelfRefCustomer.class).findRowCount() == 0) { + if (Ebean.find(SelfRefCustomer.class).findCount() == 0) { SelfRefCustomer c1 = new SelfRefCustomer(); c1.setName("Foo"); c1.setReferredBy(c1); diff --git a/src/test/java/com/avaje/tests/query/TestQueryFindFutureList.java b/src/test/java/com/avaje/tests/query/TestQueryFindFutureList.java index 51d92f922..b540a731b 100644 --- a/src/test/java/com/avaje/tests/query/TestQueryFindFutureList.java +++ b/src/test/java/com/avaje/tests/query/TestQueryFindFutureList.java @@ -48,7 +48,7 @@ public class TestQueryFindFutureList extends BaseTestCase { // wait for it to complete List orders = futureList.getUnchecked(); - assertEquals(Ebean.find(Order.class).findRowCount(), orders.size()); + assertEquals(Ebean.find(Order.class).findCount(), orders.size()); } @Test @@ -61,7 +61,7 @@ public class TestQueryFindFutureList extends BaseTestCase { // wait for it to complete List orders = futureList.getUnchecked(1, TimeUnit.SECONDS); - assertEquals(Ebean.find(Order.class).findRowCount(), orders.size()); + assertEquals(Ebean.find(Order.class).findCount(), orders.size()); } } diff --git a/src/test/java/com/avaje/tests/query/TestQueryFindPagedList.java b/src/test/java/com/avaje/tests/query/TestQueryFindPagedList.java index 501136f8c..3581fb475 100644 --- a/src/test/java/com/avaje/tests/query/TestQueryFindPagedList.java +++ b/src/test/java/com/avaje/tests/query/TestQueryFindPagedList.java @@ -83,7 +83,7 @@ public class TestQueryFindPagedList extends BaseTestCase { pagedList.loadRowCount(); List orders = pagedList.getList(); - int totalRowCount = pagedList.getTotalRowCount(); + int totalRowCount = pagedList.getTotalCount(); assertThat(orders.size()).isLessThan(totalRowCount); assertTrue(pagedList.hasNext()); @@ -96,9 +96,9 @@ public class TestQueryFindPagedList extends BaseTestCase { .setMaxRows(3) .findPagedList(); - pagedList2.loadRowCount(); + pagedList2.loadCount(); List orders2 = pagedList2.getList(); - int totalRowCount2 = pagedList2.getTotalRowCount(); + int totalRowCount2 = pagedList2.getTotalCount(); assertTrue(pagedList2.hasNext()); assertTrue(pagedList2.hasPrev()); @@ -161,11 +161,11 @@ public class TestQueryFindPagedList extends BaseTestCase { PagedList pagedList = Ebean.find(Order.class).setMaxRows(3).findPagedList(); - Future rowCount = pagedList.getFutureRowCount(); + Future rowCount = pagedList.getFutureCount(); List orders = pagedList.getList(); // these are each getting the total row count - int totalRowCount = pagedList.getTotalRowCount(); + int totalRowCount = pagedList.getTotalCount(); Integer totalRowCountWithTimeout = rowCount.get(30, TimeUnit.SECONDS); Integer totalRowCountViaFuture = rowCount.get(); @@ -183,9 +183,9 @@ public class TestQueryFindPagedList extends BaseTestCase { // fetch less that total orders (page size 3) PagedList pagedList = Ebean.find(Order.class).setMaxRows(3).findPagedList(); - pagedList.loadRowCount(); + pagedList.loadCount(); List orders = pagedList.getList(); - int totalRowCount = pagedList.getTotalRowCount(); + int totalRowCount = pagedList.getTotalCount(); assertThat(orders.size()).isLessThan(totalRowCount); } @@ -207,10 +207,10 @@ public class TestQueryFindPagedList extends BaseTestCase { try { List orders = pagedList.getList(); - int totalRowCount = pagedList.getTotalRowCount(); + int totalRowCount = pagedList.getTotalCount(); // invoke it again but cached... - int totalRowCountAgain = pagedList.getTotalRowCount(); + int totalRowCountAgain = pagedList.getTotalCount(); List loggedSql = LoggedSqlCollector.stop(); @@ -242,7 +242,7 @@ public class TestQueryFindPagedList extends BaseTestCase { LoggedSqlCollector.start(); - pagedList.getTotalRowCount(); + pagedList.getTotalCount(); pagedList.getList(); List loggedSql = LoggedSqlCollector.stop(); diff --git a/src/test/java/com/avaje/tests/query/TestQueryPlanCacheRowCount.java b/src/test/java/com/avaje/tests/query/TestQueryPlanCacheRowCount.java index 1ee498639..b31f33fe5 100644 --- a/src/test/java/com/avaje/tests/query/TestQueryPlanCacheRowCount.java +++ b/src/test/java/com/avaje/tests/query/TestQueryPlanCacheRowCount.java @@ -29,7 +29,7 @@ public class TestQueryPlanCacheRowCount extends BaseTestCase { List list0 = query.findList(); Assert.assertEquals(rc0, list0.size()); - int rc1 = query.findRowCount(); + int rc1 = query.findCount(); Assert.assertEquals(rc0, rc1); List ids1 = query.findIds(); @@ -48,7 +48,7 @@ public class TestQueryPlanCacheRowCount extends BaseTestCase { Query query2 = Ebean.find(Order.class).where().eq("status", Order.Status.NEW) .ge("id", idGt).order().desc("id"); - int rc2 = query2.findRowCount(); + int rc2 = query2.findCount(); System.out.println("Expection Not same " + rc0 + " != " + rc2); Assert.assertNotSame(rc0, rc2); diff --git a/src/test/java/com/avaje/tests/query/TestRowCount.java b/src/test/java/com/avaje/tests/query/TestRowCount.java index b8b47c3b0..ae7196f04 100644 --- a/src/test/java/com/avaje/tests/query/TestRowCount.java +++ b/src/test/java/com/avaje/tests/query/TestRowCount.java @@ -21,7 +21,7 @@ public class TestRowCount extends BaseTestCase { Query query = Ebean.find(Order.class).fetch("details").where().gt("id", 1) .gt("details.id", 1).order("id desc"); - int rc = query.findRowCount(); + int rc = query.findCount(); List ids = query.findIds(); diff --git a/src/test/java/com/avaje/tests/query/joins/TestDisjunctWhereOuterOnMany.java b/src/test/java/com/avaje/tests/query/joins/TestDisjunctWhereOuterOnMany.java index 5f41d95cc..3b9f2dab4 100644 --- a/src/test/java/com/avaje/tests/query/joins/TestDisjunctWhereOuterOnMany.java +++ b/src/test/java/com/avaje/tests/query/joins/TestDisjunctWhereOuterOnMany.java @@ -44,7 +44,7 @@ public class TestDisjunctWhereOuterOnMany extends BaseTestCase { .query(); List list = query.findList(); - int rowCount = query.findRowCount(); + int rowCount = query.findCount(); // select distinct t0.id c0, t0.name c1 // from uuone t0 diff --git a/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java b/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java index 105028ee7..f4cc122ef 100644 --- a/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java +++ b/src/test/java/com/avaje/tests/query/other/TestFormulaWithFindCount.java @@ -31,7 +31,7 @@ public class TestFormulaWithFindCount extends BaseTestCase { } ExpressionList expressionList = server.find(Order.class).where().gt("totalAmount", 1d); - int rowCount = expressionList.findRowCount(); + int rowCount = expressionList.findCount(); Assert.assertEquals(list.size(), rowCount); } diff --git a/src/test/java/com/avaje/tests/query/other/TestObjectGraphNodeStatsCollection.java b/src/test/java/com/avaje/tests/query/other/TestObjectGraphNodeStatsCollection.java index c9efc59f5..744559b44 100644 --- a/src/test/java/com/avaje/tests/query/other/TestObjectGraphNodeStatsCollection.java +++ b/src/test/java/com/avaje/tests/query/other/TestObjectGraphNodeStatsCollection.java @@ -28,7 +28,7 @@ public class TestObjectGraphNodeStatsCollection extends BaseTestCase { MetaInfoManager infoManager = server.getMetaInfoManager(); - server.find(Order.class).findRowCount(); + server.find(Order.class).findCount(); infoManager.collectNodeStatistics(true); infoManager.collectQueryPlanStatistics(true); diff --git a/src/test/java/com/avaje/tests/query/other/TestQueryConversationRowCount.java b/src/test/java/com/avaje/tests/query/other/TestQueryConversationRowCount.java index f76397580..01d64fc36 100644 --- a/src/test/java/com/avaje/tests/query/other/TestQueryConversationRowCount.java +++ b/src/test/java/com/avaje/tests/query/other/TestQueryConversationRowCount.java @@ -47,7 +47,7 @@ public class TestQueryConversationRowCount extends BaseTestCase { LoggedSqlCollector.start(); - query.findRowCount(); + query.findCount(); // select count(*) from ( // select distinct t0.id c0 diff --git a/src/test/java/com/avaje/tests/query/other/TestQueryRawExpressionMany.java b/src/test/java/com/avaje/tests/query/other/TestQueryRawExpressionMany.java index f3a448f2a..f21ea9212 100644 --- a/src/test/java/com/avaje/tests/query/other/TestQueryRawExpressionMany.java +++ b/src/test/java/com/avaje/tests/query/other/TestQueryRawExpressionMany.java @@ -27,7 +27,7 @@ public class TestQueryRawExpressionMany extends BaseTestCase { LoggedSqlCollector.start(); - query.findRowCount(); + query.findCount(); List sql = LoggedSqlCollector.stop(); assertThat(sql.get(0)).contains("select count(*) from ( select distinct t0.id c0 from o_order t0 left outer join o_order_detail t1 on t1.order_id = t0.id where t1.order_qty = ?)"); diff --git a/src/test/java/com/avaje/tests/query/other/TestQueryRowCountWithMany.java b/src/test/java/com/avaje/tests/query/other/TestQueryRowCountWithMany.java index 240039bea..bf472df71 100644 --- a/src/test/java/com/avaje/tests/query/other/TestQueryRowCountWithMany.java +++ b/src/test/java/com/avaje/tests/query/other/TestQueryRowCountWithMany.java @@ -47,7 +47,7 @@ public class TestQueryRowCountWithMany extends BaseTestCase { Assert.assertTrue(generatedSql.contains(" order by t0.cretime")); - int rowCount = query.findRowCount(); + int rowCount = query.findCount(); // select count(*) from o_order t0 // left outer join o_order_detail t1 on t1.order_id = t0.id @@ -84,7 +84,7 @@ public class TestQueryRowCountWithMany extends BaseTestCase { .orderBy("cretime asc"); LoggedSqlCollector.start(); - query.findRowCount(); + query.findCount(); List sqlLogged = LoggedSqlCollector.stop(); diff --git a/src/test/java/com/avaje/tests/query/other/TestSelfParent.java b/src/test/java/com/avaje/tests/query/other/TestSelfParent.java index 9d42bf022..7e8e35306 100644 --- a/src/test/java/com/avaje/tests/query/other/TestSelfParent.java +++ b/src/test/java/com/avaje/tests/query/other/TestSelfParent.java @@ -14,7 +14,7 @@ public class TestSelfParent extends BaseTestCase { @Test public void test() { - if (Ebean.find(SelfParent.class).findRowCount() > 0) { + if (Ebean.find(SelfParent.class).findCount() > 0) { // only run once return; } diff --git a/src/test/java/com/avaje/tests/query/softdelete/TestSoftDeletePagingList.java b/src/test/java/com/avaje/tests/query/softdelete/TestSoftDeletePagingList.java index 430facf91..caa3312da 100644 --- a/src/test/java/com/avaje/tests/query/softdelete/TestSoftDeletePagingList.java +++ b/src/test/java/com/avaje/tests/query/softdelete/TestSoftDeletePagingList.java @@ -31,7 +31,7 @@ public class TestSoftDeletePagingList { .setMaxRows(10) .findPagedList(); - int totalRowCount = pagedList.getTotalRowCount(); + int totalRowCount = pagedList.getTotalCount(); List resultList = pagedList.getList(); List sql = LoggedSqlCollector.stop(); diff --git a/src/test/java/com/avaje/tests/query/sqlquery/SqlQueryTests.java b/src/test/java/com/avaje/tests/query/sqlquery/SqlQueryTests.java index c5e507287..4e7cefb0c 100644 --- a/src/test/java/com/avaje/tests/query/sqlquery/SqlQueryTests.java +++ b/src/test/java/com/avaje/tests/query/sqlquery/SqlQueryTests.java @@ -111,7 +111,7 @@ public class SqlQueryTests extends BaseTestCase { ResetBasicData.reset(); - int expectedRows = Ebean.find(Order.class).findRowCount(); + int expectedRows = Ebean.find(Order.class).findCount(); final AtomicInteger count = new AtomicInteger(); diff --git a/src/test/java/com/avaje/tests/rawsql/TestOrderReportTotal.java b/src/test/java/com/avaje/tests/rawsql/TestOrderReportTotal.java index 5f7b53bef..d114541df 100644 --- a/src/test/java/com/avaje/tests/rawsql/TestOrderReportTotal.java +++ b/src/test/java/com/avaje/tests/rawsql/TestOrderReportTotal.java @@ -56,7 +56,7 @@ public class TestOrderReportTotal extends BaseTestCase { .where() .gt("order.id", 2) .istartsWith("order.customer.name","rob") - .findRowCount(); + .findCount(); assertThat(detailsCount).isGreaterThan(0); } diff --git a/src/test/java/com/avaje/tests/rawsql/TestRawSqlOrmQuery.java b/src/test/java/com/avaje/tests/rawsql/TestRawSqlOrmQuery.java index 3ae69818f..c8424ac7f 100644 --- a/src/test/java/com/avaje/tests/rawsql/TestRawSqlOrmQuery.java +++ b/src/test/java/com/avaje/tests/rawsql/TestRawSqlOrmQuery.java @@ -78,14 +78,14 @@ public class TestRawSqlOrmQuery extends BaseTestCase { Query query = Ebean.find(Customer.class); query.setRawSql(rawSql); - int initialRowCount = query.findRowCount(); + int initialRowCount = query.findCount(); query.setFirstRow(1); query.setMaxRows(2); List list = query.findList(); - int rowCount = query.findRowCount(); - FutureRowCount futureRowCount = query.findFutureRowCount(); + int rowCount = query.findCount(); + FutureRowCount futureRowCount = query.findFutureCount(); Assert.assertEquals(initialRowCount, rowCount); Assert.assertEquals(initialRowCount, futureRowCount.get().intValue()); @@ -110,12 +110,12 @@ public class TestRawSqlOrmQuery extends BaseTestCase { Query query = Ebean.find(Customer.class); query.setRawSql(rawSql); - int initialRowCount = query.findRowCount(); + int initialRowCount = query.findCount(); PagedList page = query.setMaxRows(2).findPagedList(); List list = page.getList(); - int rowCount = page.getTotalRowCount(); + int rowCount = page.getTotalCount(); Assert.assertEquals(2, list.size()); Assert.assertEquals(initialRowCount, rowCount); @@ -186,7 +186,7 @@ public class TestRawSqlOrmQuery extends BaseTestCase { query.order("id desc"); PagedList pagedList = query.findPagedList(); pagedList.getList(); - pagedList.getTotalRowCount(); + pagedList.getTotalCount(); assertThat(query.getGeneratedSql()).contains("order by o.id desc limit 100"); } diff --git a/src/test/java/com/avaje/tests/softdelete/TestSoftDeleteBasic.java b/src/test/java/com/avaje/tests/softdelete/TestSoftDeleteBasic.java index 30b01c627..91ac41dda 100644 --- a/src/test/java/com/avaje/tests/softdelete/TestSoftDeleteBasic.java +++ b/src/test/java/com/avaje/tests/softdelete/TestSoftDeleteBasic.java @@ -71,7 +71,7 @@ public class TestSoftDeleteBasic extends BaseTestCase { bean.setName("two"); Ebean.save(bean); - int rowCountBefore = Ebean.find(EBasicSoftDelete.class).findRowCount(); + int rowCountBefore = Ebean.find(EBasicSoftDelete.class).findCount(); Ebean.delete(EBasicSoftDelete.class, bean.getId()); @@ -79,7 +79,7 @@ public class TestSoftDeleteBasic extends BaseTestCase { // -- test .findRowCount() LoggedSqlCollector.start(); - int rowCountAfter = Ebean.find(EBasicSoftDelete.class).findRowCount(); + int rowCountAfter = Ebean.find(EBasicSoftDelete.class).findCount(); List loggedSql = LoggedSqlCollector.stop(); assertThat(loggedSql).hasSize(1); @@ -91,7 +91,7 @@ public class TestSoftDeleteBasic extends BaseTestCase { // -- test includeSoftDeletes().findRowCount() LoggedSqlCollector.start(); - int rowCountFull = Ebean.find(EBasicSoftDelete.class).setIncludeSoftDeletes().findRowCount(); + int rowCountFull = Ebean.find(EBasicSoftDelete.class).setIncludeSoftDeletes().findCount(); assertThat(rowCountFull).isGreaterThan(rowCountAfter); loggedSql = LoggedSqlCollector.stop(); @@ -197,7 +197,7 @@ public class TestSoftDeleteBasic extends BaseTestCase { Ebean.find(EBasicSoftDelete.class) .setId(bean.getId()) .where() - .includeSoftDeletes() + .setIncludeSoftDeletes() .findUnique(); assertThat(fetchAllWithLazy.getChildren()).hasSize(3); diff --git a/src/test/java/com/avaje/tests/transaction/TestExplicitTransactionMode.java b/src/test/java/com/avaje/tests/transaction/TestExplicitTransactionMode.java index b33455217..f1edf9e53 100644 --- a/src/test/java/com/avaje/tests/transaction/TestExplicitTransactionMode.java +++ b/src/test/java/com/avaje/tests/transaction/TestExplicitTransactionMode.java @@ -70,7 +70,7 @@ public class TestExplicitTransactionMode extends BaseTestCase { } // rollback as expected - assertEquals(0, ebeanServer.find(UTMaster.class).findRowCount()); + assertEquals(0, ebeanServer.find(UTMaster.class).findCount()); UTMaster bean1 = new UTMaster("one1"); UTMaster bean2 = new UTMaster("two2"); diff --git a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequired.java b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequired.java index 7782712f7..163463ed5 100644 --- a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequired.java +++ b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequired.java @@ -25,11 +25,11 @@ public class TestNestedBeginRequired extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.required()); try { - server.find(Country.class).findRowCount(); + server.find(Country.class).findCount(); someInnerMethod(); - server.find(Product.class).findRowCount(); + server.find(Product.class).findCount(); txn.commit(); @@ -45,7 +45,7 @@ public class TestNestedBeginRequired extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.required()); try { - server.find(Customer.class).findRowCount(); + server.find(Customer.class).findCount(); txn.commit(); diff --git a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiredWithFailure.java b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiredWithFailure.java index 7b3945ed8..1f52a9c03 100644 --- a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiredWithFailure.java +++ b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiredWithFailure.java @@ -23,12 +23,12 @@ public class TestNestedBeginRequiredWithFailure extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.required()); try { - server.find(Country.class).findRowCount(); + server.find(Country.class).findCount(); try { someInnerMethodWithFailure(); - server.find(Product.class).findRowCount(); + server.find(Product.class).findCount(); txn.commit(); } catch (RuntimeException e) { @@ -50,7 +50,7 @@ public class TestNestedBeginRequiredWithFailure extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.required()); try { - server.find(Customer.class).findRowCount(); + server.find(Customer.class).findCount(); EBasic basic = new EBasic(); basic.setName("ignore"); diff --git a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNew.java b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNew.java index 11a231d09..21d85d4b0 100644 --- a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNew.java +++ b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNew.java @@ -25,11 +25,11 @@ public class TestNestedBeginRequiresNew extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.requiresNew()); try { - server.find(Country.class).findRowCount(); + server.find(Country.class).findCount(); someInnerMethod(); - server.find(Product.class).findRowCount(); + server.find(Product.class).findCount(); txn.commit(); @@ -45,7 +45,7 @@ public class TestNestedBeginRequiresNew extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.requiresNew()); try { - server.find(Customer.class).findRowCount(); + server.find(Customer.class).findCount(); txn.commit(); } finally { diff --git a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNewWithFailure.java b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNewWithFailure.java index eea7e3175..a99324c69 100644 --- a/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNewWithFailure.java +++ b/src/test/java/com/avaje/tests/transaction/TestNestedBeginRequiresNewWithFailure.java @@ -25,14 +25,14 @@ public class TestNestedBeginRequiresNewWithFailure extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.requiresNew()); try { - server.find(Country.class).findRowCount(); + server.find(Country.class).findCount(); try { someInnerMethodWithFailure(); } catch (RuntimeException e) { logger.info("Inner method failed with " + e.getMessage()); } - server.find(Product.class).findRowCount(); + server.find(Product.class).findCount(); txn.commit(); @@ -48,7 +48,7 @@ public class TestNestedBeginRequiresNewWithFailure extends BaseTestCase { Transaction txn = server.beginTransaction(TxScope.requiresNew()); try { - server.find(Customer.class).findRowCount(); + server.find(Customer.class).findCount(); if (server != null) { throw new RuntimeException("barf");