From e0272d0d39dfa76dd292dc07e6f674431f25a644 Mon Sep 17 00:00:00 2001 From: Carlos Chacin Date: Sat, 29 Nov 2025 15:13:27 -0800 Subject: [PATCH] fix: Add GenerationType and Transactional annotations Add missing annotations required for the examples to work properly: - `@GeneratedValue(strategy = GenerationType.IDENTITY)` for auto-incremental id - `@Transactional` for the `DELETE` endpoint to work --- modules/ROOT/pages/chapter03/chapter03.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/chapter03/chapter03.adoc b/modules/ROOT/pages/chapter03/chapter03.adoc index 7b0fb366..cebba3b4 100644 --- a/modules/ROOT/pages/chapter03/chapter03.adoc +++ b/modules/ROOT/pages/chapter03/chapter03.adoc @@ -140,6 +140,7 @@ package io.microprofile.tutorial.store.product.entity; import jakarta.persistence.Entity; import jakarta.persistence.Id; import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; import jakarta.validation.constraints.NotNull; @Entity @@ -152,7 +153,7 @@ import jakarta.validation.constraints.NotNull; public class Product { @Id - @GeneratedValue + @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @@ -471,6 +472,7 @@ $ curl http://localhost:9080/mp-ecomm-store/api/products [source, java] ---- @DELETE +@Transactional @Path("products/{id}") public Response deleteProduct(@PathParam("id") Long id) { // Delete a product