public CompareShippingReport(Map<String, Object> parameters) {
        
        try(Connection connection = ServiceDB.getConnection(Application.getContext().getUserDB().getLogin(), Application.getContext().getUserDB().getPassword())){
            connection.setAutoCommit(false);
            
            try(Statement statement = connection.createStatement()){
                Set<Direction> set = (Set<Direction>) parameters.get("vectorSale");
                if(!set.isEmpty()) {
                    statement.addBatch(QueriesMarket.DELETE_TMP1.getQuery());
                    Iterator<Direction> iterator = set.iterator();
                    while(iterator.hasNext()){
                    Direction direction = iterator.next();
                    statement.addBatch(String.format(QueriesMarket.INSERT_TMP1.getQuery(), direction.getId()));
                    }
                }
                List<Agent> agents = (List<Agent>) parameters.get("selectedAgent"); 
                if(!agents.isEmpty()) {
                    statement.addBatch(QueriesMarket.DELETE_TMP2.getQuery());
                    Iterator<Agent> iterator = agents.iterator();
                    while(iterator.hasNext()){
                        Agent agent = iterator.next();
                        statement.addBatch(String.format(QueriesMarket.INSERT_TMP2.getQuery(), agent.getId()));
                    }
                }
                statement.executeBatch();
                connection.commit();
                connection.setAutoCommit(true);
            } catch (SQLException ex) {
                connection.rollback();
            }
            
            try(PreparedStatement prepare = connection.prepareStatement(QueriesMarket.QUERY_COMPARE_REPORT.getQuery())){
                prepare.setInt(1, (int) parameters.get("v_reg"));
                prepare.setInt(2, (int) parameters.get("v_id_reg"));
                prepare.setInt(3, (int) parameters.get("v_price_variant"));
                prepare.setInt(4, (int) parameters.get("v_num_reg_price"));
                prepare.setInt(5, (int) parameters.get("v_id_group_price"));
                prepare.setInt(6, (int) parameters.get("v_diff_pos"));
                prepare.setDate(7, (Date) parameters.get("date_start_1"));
                prepare.setDate(8, (Date) parameters.get("date_end_1"));
                prepare.setDate(9, (Date) parameters.get("date_start_2"));
                prepare.setDate(10, (Date) parameters.get("date_end_2"));
                prepare.setInt(11, (int) parameters.get("v_group"));
                
                try(ResultSet result = prepare.executeQuery()){
                    rowSet = new CachedRowSetImpl();
                    rowSet.populate(result);
                    ResultSetMetaData metadata = rowSet.getMetaData();
                    columnCount = metadata.getColumnCount();

                    columnNames = new String[columnCount];
                    for(int i = 0; i < columnCount; i++){
                        columnNames[i] = metadata.getColumnName(i + 1);
                    }

                    while(rowSet.next()) {
                        rowCount++;
                    }
                }                
            }    
        } catch (SQLException ex) {
            Application.getLogger().log(Level.SEVERE, null, ex);
        }
        
    }