io.ebeaninternal.server.query.CallableQueryCount Maven / Gradle / Ivy
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 the entity bean type
*/
public class CallableQueryCount extends CallableQuery implements Callable {
/**
* 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 query, Transaction t) {
super(server, query, t);
}
/**
* Execute the query returning the row count.
*/
@Override
public Integer call() throws Exception {
try {
return server.findCountWithCopy(query, transaction);
} finally {
// cleanup the underlying connection
transaction.end();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy