return departments;
}
@Override
public Department findEntityById(int id) throws DaoException {
Department department = new Department();
try (DbConnection connection = DbConnectionPool.INSTANCE.getConnection();
PreparedStatement categoryStatement = connection.prepareStatement(SQL_CATEGORY_BY_DEPARTMENT);
PreparedStatement idStatement = connection.prepareStatement(SQL_FIND_BY_ID)) {
idStatement.setInt(1, id);
ResultSet resultSet = idStatement.executeQuery();
if (resultSet.next()) {
fillUpDepartment(resultSet, department);
categoryStatement.setInt(1, department.getUid());
ResultSet categoriesResultSet = categoryStatement.executeQuery();
setDepartmentCategories(categoriesResultSet, department);
}
} catch (SQLException e) {
log.error("Error during statement creation", e);