#921 - Refactor internals - Change internal use of "findRowCount" to "findCount"

This commit is contained in:
Rob Bygrave
2016-12-13 19:51:11 +13:00
parent f429811f79
commit cf37fda3f4
17 changed files with 36 additions and 41 deletions
@@ -0,0 +1,36 @@
package io.ebeaninternal.server.query;
import io.ebean.Transaction;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiQuery;
import java.util.concurrent.Callable;
/**
* Represent the findCount query as a Callable.
*
* @param <T> the entity bean type
*/
public class CallableQueryCount<T> extends CallableQuery<T> implements Callable<Integer> {
/**
* Note that the transaction passed in is always a new transaction solely to
* find the row count so it must be cleaned up by this CallableQueryRowCount.
*/
public CallableQueryCount(SpiEbeanServer server, SpiQuery<T> query, Transaction t) {
super(server, query, t);
}
/**
* Execute the query returning the row count.
*/
public Integer call() throws Exception {
try {
return server.findCountWithCopy(query, transaction);
} finally {
// cleanup the underlying connection
transaction.end();
}
}
}