Package by.bsuir.hypermarket.entity

Examples of by.bsuir.hypermarket.entity.Goods


    try (DbConnection connection = DbConnectionPool.INSTANCE.getConnection();
        PreparedStatement statement = connection.prepareStatement(SQL_FIND_ALL);
        PreparedStatement producerStatement = connection.prepareStatement(SQL_FIND_PRODUCER_BY_ID)) {
      ResultSet resultSet = statement.executeQuery();
      while (resultSet.next()) {
        Goods goods = new Goods();
        fillUpGoodsEntity(resultSet, goods);
       
        producerStatement.setInt(1, goods.getProducer().getUid());
        ResultSet producerResultSet = producerStatement.executeQuery();
        setProducerAddresses(producerResultSet, goods);
       
        goodsList.add(goods);
      }
View Full Code Here


    return goodsList;
  }

  @Override
  public Goods findEntityById(int id) throws DaoException {
    Goods goods = new Goods();
    try (DbConnection connection = DbConnectionPool.INSTANCE.getConnection();
        PreparedStatement idStatement = connection.prepareStatement(SQL_FIND_BY_ID);
        PreparedStatement producerStatement = connection.prepareStatement(SQL_FIND_PRODUCER_BY_ID)) {
      idStatement.setInt(1, id);
      ResultSet resultSet = idStatement.executeQuery();
      if (resultSet.next()) {
        fillUpGoodsEntity(resultSet, goods);
       
        producerStatement.setInt(1, goods.getProducer().getUid());
        resultSet = producerStatement.executeQuery();
        setProducerAddresses(resultSet, goods);
      }
    } catch (SQLException e) {
      log.error("Error during goods searching by id", e);
View Full Code Here

        PreparedStatement idStatement = connection.prepareStatement(SQL_FIND_BY_DEPARTMENT);
        PreparedStatement producerStatement = connection.prepareStatement(SQL_FIND_PRODUCER_BY_ID)) {
      idStatement.setInt(1, id);
      ResultSet resultSet = idStatement.executeQuery();
      while (resultSet.next()) {
        Goods goods = new Goods();
        fillUpGoodsEntity(resultSet, goods);
       
        producerStatement.setInt(1, goods.getProducer().getUid());
        ResultSet producerAddresses = producerStatement.executeQuery();
        setProducerAddresses(producerAddresses, goods);
       
        goodsList.add(goods);
      }
View Full Code Here

        PreparedStatement idStatement = connection.prepareStatement(SQL_FIND_BY_CATEGORY);
        PreparedStatement producerStatement = connection.prepareStatement(SQL_FIND_PRODUCER_BY_ID)) {
      idStatement.setInt(1, id);
      ResultSet resultSet = idStatement.executeQuery();
      while (resultSet.next()) {
        Goods goods = new Goods();
        fillUpGoodsEntity(resultSet, goods);
       
        producerStatement.setInt(1, goods.getProducer().getUid());
        ResultSet producerAddresses = producerStatement.executeQuery();
        setProducerAddresses(producerAddresses, goods);
       
        goodsList.add(goods);
      }
View Full Code Here

TOP

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

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.