Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 546 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 442 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
Chapter 13: products won't get reviewed

Hi,
I'm doing the Java 11 25th Aniversary Learningpath. And doing the labs, of chapter 13, I encounter that after changing the code to load all the data from files, I see that the product reviews are loaded, but the products aren't actually Rated. While in the video I see that apparently the code from the presenter has ratings for the product.
Now, going through my code, I reviewed several times that my source matches that from the video. And I think it's logical that my products won't get rated. As I understand it, the .Collectors.toMap(product -> product, product -> loadReviews(product) part in the loadAllData() method does combine the product with the reviews list. But the reviews aren't averaging the rewiew ratings into the product.rating.
Do I miss something?
Kind regards,
Martien
Answers
-
that cause on the previous chapter the default product review was not rated but in this chapter if you looks on the video when the instructor opened one of the product's files you would see it has default review
and he do not save the product after apply review prduct file does not change
i also trapped on that one till i double check the part when he opened the product file
hope that help and have a nice day :)
-
Practice 13.2
Goals:
• Existing algorithms of the parseReview and parseProduct methods automatically add Review and Product objects to the products Map collection.
• Such an approach is not suitable for a bulk data load scenario, because every time you invoke the writeReview method it recalculates the average rating value for all reviews of this product and recreates products by applying the new rating value.
• You also need to be able to use Java Stream API Collectors to improve bulk load performance and possibly allow parallel processing of information.
• You need to load data for your products and reviews from files as is, without constantly recalculating values.
This is achieved by loading product information and all reviews for a product first, modifying the parseReview and parseProduct methods so they don't immediately add products and review to the map. The assumption is that product stored in the csv file is consistent with all of its reviews stored in another csv. This is not unlike loading data from the database where you don't expect to perform all calculations, but rather treat selected table data as consistent by default. Remember that since as early as practice 5.2 product can be created with a specified rating immediately, without actually having to calculate it from all reviews. Once product and all of its reviews are loaded, they can be added to a map stored in the ProductManager.
The rest of the logic remains the same - a review can be applied to the product, causing its recreation and reinsertion into the map. No further calculations are required at printing stage not in this nor any earlier practice.
-
sorry for my miss understanding and thanks for correcting me and clearing that and thanks alot for you for many f the indepth thing and how thing wokring from behind scene that you teached us on that course and thanks for orcale to offer this course for free :)
thanks again and have a nice day :)