@Override public Long inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception { final EntitySqlDao<M, E> transactional = entitySqlDaoWrapperFactory.become(realSqlDao); return transactional.getCount(context); } });
@Override public Pagination<M> getAll(final InternalTenantContext context) { // We usually always want to wrap our queries in an EntitySqlDaoTransactionWrapper... except here. // Since we want to stream the results out, we don't want to auto-commit when this method returns. final EntitySqlDao<M, E> sqlDao = transactionalSqlDao.onDemandForStreamingResults(realSqlDao); // Note: we need to perform the count before streaming the results, as the connection // will be busy as we stream the results out. This is also why we cannot use // SQL_CALC_FOUND_ROWS / FOUND_ROWS (which may not be faster anyways). final Long count = sqlDao.getCount(context); final Iterator<M> results = sqlDao.getAll(context); return new DefaultPagination<M>(count, results); }
maxNbRecords = null; } else { maxNbRecords = sqlDao.getCount(context);
@Override public Long inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception { final EntitySqlDao<M, E> transactional = entitySqlDaoWrapperFactory.become(realSqlDao); return transactional.getCount(context); } });
@Override public Pagination<M> getAll(final InternalTenantContext context) { // We usually always want to wrap our queries in an EntitySqlDaoTransactionWrapper... except here. // Since we want to stream the results out, we don't want to auto-commit when this method returns. final EntitySqlDao<M, E> sqlDao = transactionalSqlDao.onDemandForStreamingResults(realSqlDao); // Note: we need to perform the count before streaming the results, as the connection // will be busy as we stream the results out. This is also why we cannot use // SQL_CALC_FOUND_ROWS / FOUND_ROWS (which may not be faster anyways). final Long count = sqlDao.getCount(context); final Iterator<M> results = sqlDao.getAll(context); return new DefaultPagination<M>(count, results); }
maxNbRecords = null; } else { maxNbRecords = sqlDao.getCount(context);