У меня есть класс BeanProcessor с двумя членами: int totalRecords; и String countQuery;
Вот код моего класса DAO:
Код: Выделить всё
public BeanProcessor selectAll() throws SQLException {
ResultSet rs = null;
PreparedStatement ps = null;
Connection cnn = null;
BeanProcessor bean = new BeanProcessor();
try {
if ((cnn == null) || cnn.isClosed()) {
cnn = getConnection();
}
String countQuery = "select count(*) from "+ bean.getCountQuery();
ps = cnn.prepareStatement(countQuery);
rs = ps.executeQuery();
if (rs.next()) {
bean.setTotalRecords(rs.getInt(1));
}
} catch (Exception e) {
EmailErrorsToAdmin.setMsg(this.getClass().getCanonicalName(), e);
} finally {
DbUtils.closeQuietly(rs);
DbUtils.closeQuietly(ps);
DbUtils.closeQuietly(cnn);
}
return bean;
}
Код: Выделить всё
private int countRecords(String tableName) {
CountQueryDAO db = new CountQueryDAO();
BeanProcessor bean = new BeanProcessor();
db.selectAll(bean.setCountQuery(tableName));
return bean.getTotalRecords();
}
Здесь метод выдает ошибку:
Метод selectAll() в типе CountQueryDAO неприменим для аргументов (void)

Спасибо
Подробнее здесь: https://stackoverflow.com/questions/790 ... an-in-java
Мобильная версия