Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: product pkey conflict caused by import.sql #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
15 changes: 8 additions & 7 deletions code/exercise_011_Going_Reactive/src/main/resources/import.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
2 changes: 1 addition & 1 deletion code/exercise_014_Internal_Channels/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class PriceUpdateStreams {
}
```

* Implement the method `public Multi<PriceUpdate> generate()` on the `PriceUpdateStreams` class, and make it return a `Multi` that emits a `PriceUpdate` item *every five seconds*, using a random price between 0 and 100, for each of the products in our database (You can hardcode the product IDs 1 to 7 inclusive) .
* Implement the method `public Multi<PriceUpdate> generate()` on the `PriceUpdateStreams` class, and make it return a `Multi` that emits a `PriceUpdate` item *every five seconds*, using a random price between 0 and 100, for each of the products in our database (You can hardcode the product IDs - use `curl localhost:8080/products` to discover the product IDs saved in the database) .

Tip, look at the `Multi.createFrom().ticks()` method!
Note that the `print` method has an `@Incoming` annotation that matches the `@Outgoing` from the `generate` method. Running the application should print seven lines to the console every five seconds, each line being a price update for a product. Run the app to try this :)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
ALTER SEQUENCE Product_SEQ INCREMENT BY 1;
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Dinner Table', 'Sturdy oak Table', 200);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Coffee Table', 'An oak coffee Table', 120);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Side Table', 'A Nice little oak side table', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Mirror', 'A round mirror with oak frame', 80);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Lamp', 'A light that shines', 45);
INSERT into Product (id, name, description, price) VALUES (nextval('Product_SEQ'), 'Carpet', 'Soft carpet', 39.95);
Loading