Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 9bd1fd5

Browse files
authored
Fix/hibernate entity sequence (#13)
* update quarkus version 2.9.1.Final -> 3.4.3 * Exercice 5 : adapt entity and import statement for Hibernate ORM 6 * Exercice 6 -11 : adapt entity and import statement for Hibernate ORM 6 * Exercice 12 - 16 : adapt entity and import statement for Hibernate ORM 6 * Exercice 11 : Use mutiny's Uni only, rm Multi mention * Exercice 11 : Use mutiny's Uni only, rm Multi mention * fix : hibernate entity sequence, forgotten entities in exercice 10 & 14
1 parent 9b9c9c8 commit 9bd1fd5

File tree

20 files changed

+97
-176
lines changed
  • code
    • exercise_005_products_from_the_database/src/main/java/com/lunatech/training/quarkus
    • exercise_006_CDI_and_ArC/src/main/java/com/lunatech/training/quarkus
    • exercise_008_Adding_REST_data_Panache/src/main
    • exercise_009_Hook_up_the_React_app/src/main
    • exercise_010_Validation_and_PUT/src/main
    • exercise_011_Going_Reactive/src/main
    • exercise_012_Reactive_search_endpoint/src/main
    • exercise_013_Listen_and_Notify/src/main
    • exercise_014_Internal_Channels/src/main
    • exercise_015_Connecting_to_Kafka/src/main
    • exercise_016_Dead_Letter_Queue_and_Stream_filtering/src/main

20 files changed

+97
-176
lines changed

code/exercise_005_products_from_the_database/src/main/java/com/lunatech/training/quarkus/Product.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
package com.lunatech.training.quarkus;
22

3-
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
4-
import jakarta.persistence.Entity;
5-
import jakarta.persistence.GeneratedValue;
6-
import jakarta.persistence.GenerationType;
7-
import jakarta.persistence.Id;
3+
import io.quarkus.hibernate.orm.panache.PanacheEntity;
84

5+
import jakarta.persistence.Entity;
96
import java.math.BigDecimal;
107

118
@Entity
12-
public class Product extends PanacheEntityBase {
9+
public class Product extends PanacheEntity {
1310

14-
@Id
15-
@GeneratedValue(strategy = GenerationType.IDENTITY)
16-
public Long id;
1711
public String name;
1812
public String description;
1913
public BigDecimal price;
2014

21-
public Product() {}
15+
public Product(){}
2216

2317
public Product(Long id, String name, String description, BigDecimal price) {
2418
this.id = id;

code/exercise_006_CDI_and_ArC/src/main/java/com/lunatech/training/quarkus/Product.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22

33
import io.quarkus.hibernate.orm.panache.PanacheEntity;
44

5-
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
65
import jakarta.persistence.Entity;
7-
import jakarta.persistence.GeneratedValue;
8-
import jakarta.persistence.GenerationType;
9-
import jakarta.persistence.Id;
10-
116
import java.math.BigDecimal;
127

138
@Entity
14-
public class Product extends PanacheEntityBase {
9+
public class Product extends PanacheEntity {
1510

16-
@Id
17-
@GeneratedValue(strategy = GenerationType.IDENTITY)
18-
public Long id;
1911
public String name;
2012
public String description;
2113
public BigDecimal price;

code/exercise_008_Adding_REST_data_Panache/src/main/java/com/lunatech/training/quarkus/Product.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22

33
import io.quarkus.hibernate.orm.panache.PanacheEntity;
44

5-
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
65
import jakarta.persistence.Entity;
7-
import jakarta.persistence.GeneratedValue;
8-
import jakarta.persistence.GenerationType;
9-
import jakarta.persistence.Id;
10-
116
import java.math.BigDecimal;
127

138
@Entity
14-
public class Product extends PanacheEntityBase {
9+
public class Product extends PanacheEntity {
1510

16-
@Id
17-
@GeneratedValue(strategy = GenerationType.IDENTITY)
18-
public Long id;
1911
public String name;
2012
public String description;
2113
public BigDecimal price;
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
2-
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
3-
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
4-
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
5-
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
6-
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
7-
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
1+
INSERT into Product (id, name, description, price) VALUES (nextval('product_seq'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
2+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Dinner Table', 'Sturdy oak Table', 200);
3+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Coffee Table', 'An oak coffee Table', 120);
4+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Side Table', 'A Nice little oak side table', 80);
5+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Mirror', 'A round mirror with oak frame', 80);
6+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Lamp', 'A light that shines', 45);
7+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Carpet', 'Soft carpet', 39.95);

code/exercise_009_Hook_up_the_React_app/src/main/java/com/lunatech/training/quarkus/Product.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22

33
import io.quarkus.hibernate.orm.panache.PanacheEntity;
44

5-
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
65
import jakarta.persistence.Entity;
7-
import jakarta.persistence.GeneratedValue;
8-
import jakarta.persistence.GenerationType;
9-
import jakarta.persistence.Id;
10-
116
import java.math.BigDecimal;
127

138
@Entity
14-
public class Product extends PanacheEntityBase {
9+
public class Product extends PanacheEntity {
1510

16-
@Id
17-
@GeneratedValue(strategy = GenerationType.IDENTITY)
18-
public Long id;
1911
public String name;
2012
public String description;
2113
public BigDecimal price;
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
2-
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
3-
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
4-
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
5-
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
6-
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
7-
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
1+
INSERT into Product (id, name, description, price) VALUES (nextval('product_seq'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
2+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Dinner Table', 'Sturdy oak Table', 200);
3+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Coffee Table', 'An oak coffee Table', 120);
4+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Side Table', 'A Nice little oak side table', 80);
5+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Mirror', 'A round mirror with oak frame', 80);
6+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Lamp', 'A light that shines', 45);
7+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Carpet', 'Soft carpet', 39.95);

code/exercise_010_Validation_and_PUT/src/main/java/com/lunatech/training/quarkus/Product.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
package com.lunatech.training.quarkus;
22

33
import io.quarkus.hibernate.orm.panache.PanacheEntity;
4-
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
5-
import jakarta.persistence.GeneratedValue;
6-
import jakarta.persistence.GenerationType;
7-
import jakarta.persistence.Id;
8-
import org.hibernate.validator.constraints.Length;
94

105
import jakarta.persistence.Entity;
116
import jakarta.validation.constraints.DecimalMin;
127
import jakarta.validation.constraints.Digits;
138
import jakarta.validation.constraints.NotNull;
9+
import org.hibernate.validator.constraints.Length;
10+
1411
import java.math.BigDecimal;
1512

1613
@Entity
17-
public class Product extends PanacheEntityBase {
18-
19-
@Id
20-
@GeneratedValue(strategy = GenerationType.IDENTITY)
21-
public Long id;
14+
public class Product extends PanacheEntity {
2215

2316
@NotNull
2417
@Length(min = 3)
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
2-
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
3-
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
4-
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
5-
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
6-
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
7-
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
1+
INSERT into Product (id, name, description, price) VALUES (nextval('product_seq'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
2+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Dinner Table', 'Sturdy oak Table', 200);
3+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Coffee Table', 'An oak coffee Table', 120);
4+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Side Table', 'A Nice little oak side table', 80);
5+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Mirror', 'A round mirror with oak frame', 80);
6+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Lamp', 'A light that shines', 45);
7+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Carpet', 'Soft carpet', 39.95);

code/exercise_011_Going_Reactive/src/main/java/com/lunatech/training/quarkus/Product.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
package com.lunatech.training.quarkus;
22

3-
import io.quarkus.hibernate.reactive.panache.PanacheEntityBase;
3+
import org.hibernate.validator.constraints.Length;
4+
import io.quarkus.hibernate.reactive.panache.PanacheEntity;
5+
46
import jakarta.persistence.Entity;
5-
import jakarta.persistence.GeneratedValue;
6-
import jakarta.persistence.GenerationType;
7-
import jakarta.persistence.Id;
87
import jakarta.validation.constraints.DecimalMin;
98
import jakarta.validation.constraints.Digits;
109
import jakarta.validation.constraints.NotNull;
11-
import org.hibernate.validator.constraints.Length;
12-
1310
import java.math.BigDecimal;
1411

1512
@Entity
16-
public class Product extends PanacheEntityBase {
17-
18-
@Id
19-
@GeneratedValue(strategy = GenerationType.IDENTITY)
20-
public Long id;
13+
public class Product extends PanacheEntity {
2114

2215
@NotNull
2316
@Length(min = 3)
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
INSERT into Product (id, name, description, price) VALUES (1, 'Chair', 'A metal frame chair, with oak seat', 59.95);
2-
INSERT into Product (id, name, description, price) VALUES (2, 'Dinner Table', 'Sturdy oak Table', 200);
3-
INSERT into Product (id, name, description, price) VALUES (3, 'Coffee Table', 'An oak coffee Table', 120);
4-
INSERT into Product (id, name, description, price) VALUES (4, 'Side Table', 'A Nice little oak side table', 80);
5-
INSERT into Product (id, name, description, price) VALUES (5, 'Mirror', 'A round mirror with oak frame', 80);
6-
INSERT into Product (id, name, description, price) VALUES (6, 'Lamp', 'A light that shines', 45);
7-
INSERT into Product (id, name, description, price) VALUES (7, 'Carpet', 'Soft carpet', 39.95);
1+
INSERT into Product (id, name, description, price) VALUES (nextval('product_seq'), 'Chair', 'A metal frame chair, with oak seat', 59.95);
2+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Dinner Table', 'Sturdy oak Table', 200);
3+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Coffee Table', 'An oak coffee Table', 120);
4+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Side Table', 'A Nice little oak side table', 80);
5+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Mirror', 'A round mirror with oak frame', 80);
6+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Lamp', 'A light that shines', 45);
7+
INSERT into Product (id, name, description, price) VALUES (nextval('Product_seq'), 'Carpet', 'Soft carpet', 39.95);

0 commit comments

Comments
 (0)