return producers;
}
@Override
public Producer findEntityById(int id) throws DaoException {
Producer producer = new Producer();
try (DbConnection connection = DbConnectionPool.INSTANCE.getConnection();
PreparedStatement idStatement = connection.prepareStatement(FIND_BY_ID);
PreparedStatement producerStatement = connection.prepareStatement(FIND_PRODUCER_BY_ID)) {
idStatement.setInt(1, id);
ResultSet resultSet = idStatement.executeQuery();
if (resultSet.next()) {
producer.setUid(id);
producer.setName(resultSet.getString("p_name"));
producer.setPhoneNumber(resultSet.getString("p_phone"));
producer.setEmail(resultSet.getString("p_email"));
producerStatement.setInt(1, producer.getUid());
ResultSet producerResultSet = producerStatement.executeQuery();
setProducerAddresses(producerResultSet, producer);
}
} catch (SQLException e) {
log.error("Error during statement creation", e);