All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeaninternal.server.query.CallableQueryRowCount Maven / Gradle / Ivy

There is a newer version: 8.1.1
Show newest version
package com.avaje.ebeaninternal.server.query;

import java.util.concurrent.Callable;

import com.avaje.ebean.Transaction;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.api.SpiQuery;

/**
 * Represent the findRowCount query as a Callable.
 *
 * @param  the entity bean type
 */
public class CallableQueryRowCount 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 CallableQueryRowCount(SpiEbeanServer server, SpiQuery query, Transaction t) {
    super(server, query, t);
  }

  /**
   * Execute the query returning the row count.
   */
  public Integer call() throws Exception {
    try {
      return server.findRowCountWithCopy(query, transaction);
    } finally {
      // cleanup the underlying connection
      transaction.end();
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy