Package by.bsuir.hypermarket.entity

Examples of by.bsuir.hypermarket.entity.Department


    try (DbConnection connection = DbConnectionPool.INSTANCE.getConnection();
        PreparedStatement categoryStatement = connection.prepareStatement(SQL_CATEGORY_BY_DEPARTMENT);
        PreparedStatement departmentStatement = connection.prepareStatement(SQL_FIND_ALL)) {   
      ResultSet resultSet = departmentStatement.executeQuery();
      while (resultSet.next()) {
        Department department = new Department();
        fillUpDepartment(resultSet, department);
       
        categoryStatement.setInt(1, department.getUid());
        ResultSet categoriesResultSet = categoryStatement.executeQuery();
        setDepartmentCategories(categoriesResultSet, department);
   
        departments.add(department);
      }
View Full Code Here


    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);
View Full Code Here

    Country country = new Country();
    country.setUid(resultSet.getInt("country_uid"));
    country.setName(resultSet.getString("goods_from"));
    goods.setCountry(country);
   
    Department department = new Department();
    department.setUid(resultSet.getInt("d_uid"));
    department.setName(resultSet.getString("d_name"))
    department.setPhoneNumber(resultSet.getString("d_phone_num"));
    goods.setDepartment(department);
   
    Category category = new Category();
    category.setUid(resultSet.getInt("c_uid"));
    category.setName(resultSet.getString("c_name"));
View Full Code Here

TOP

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

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.