Package by.bsuir.hypermarket.entity

Examples of by.bsuir.hypermarket.entity.Address


    List<Address> addresses = new ArrayList<Address>();
    try (DbConnection connection = DbConnectionPool.INSTANCE.getConnection();
        PreparedStatement statement = connection.prepareStatement(SQL_FIND_ALL)){
      ResultSet resultSet = statement.executeQuery();
      while (resultSet.next()) {
        Address address = new Address();
        fillUpAddress(resultSet, address);
        addresses.add(address);
      }
    } catch (ConnectionPoolException e) {
      log.error("Error during getting connection from the pool", e);
View Full Code Here


    return addresses;
  }

  @Override
  public Address findEntityById(int id) throws DaoException {
    Address address = new Address();
    try (DbConnection connection = DbConnectionPool.INSTANCE.getConnection();
        PreparedStatement idStatement = connection.prepareStatement(SQL_FIND_BY_ID)) {
      idStatement.setInt(1, id);
      ResultSet resultSet = idStatement.executeQuery();
      if (resultSet.next()) {
View Full Code Here

  }
 
  private void setProducerAddresses(ResultSet resultSet, Goods goods) throws SQLException {
    List<Address> addresses = new ArrayList<Address>();
    while (resultSet.next()) {
      Address address = new Address();
      address.setAppartment(resultSet.getInt("a_appartment"));
      address.setBuilding(resultSet.getInt("a_building"));
      Country country = new Country();
      country.setName(resultSet.getString("country_name"));
      country.setUid(resultSet.getInt("a_c_uid"));
      address.setCountry(country);
      address.setDistrict(resultSet.getString("a_district"));
      address.setHouseNumber(resultSet.getInt("a_house_num"));
      address.setRegion(resultSet.getString("a_region"));
      address.setStreet(resultSet.getString("a_street"));
      address.setUid(resultSet.getInt("a_uid"));
      address.setZipCode(resultSet.getInt("a_zip_code"));
      addresses.add(address);
    }
    goods.getProducer().setAddresses(addresses);
  }
View Full Code Here

  }
 
  private void setProducerAddresses(ResultSet resultSet, Producer producer) throws SQLException {
    List<Address> addresses = new ArrayList<Address>();
    while (resultSet.next()) {
      Address address = new Address();
      address.setAppartment(resultSet.getInt("a_appartment"));
      address.setBuilding(resultSet.getInt("a_building"));
      Country country = new Country();
      country.setName(resultSet.getString("country_name"));
      country.setUid(resultSet.getInt("a_c_uid"));
      address.setCountry(country);
      address.setDistrict(resultSet.getString("a_district"));
      address.setHouseNumber(resultSet.getInt("a_house_num"));
      address.setRegion(resultSet.getString("a_region"));
      address.setStreet(resultSet.getString("a_street"));
      address.setUid(resultSet.getInt("a_uid"));
      address.setZipCode(resultSet.getInt("a_zip_code"));
      addresses.add(address);
    }
    producer.setAddresses(addresses);
  }
View Full Code Here

TOP

Related Classes of by.bsuir.hypermarket.entity.Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.