Skip to content

Commit e83574a

Browse files
authored
fix: Add GenerationType and Transactional annotations (#59)
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
1 parent a192733 commit e83574a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/ROOT/pages/chapter03/chapter03.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ package io.microprofile.tutorial.store.product.entity;
140140
import jakarta.persistence.Entity;
141141
import jakarta.persistence.Id;
142142
import jakarta.persistence.GeneratedValue;
143+
import jakarta.persistence.GenerationType;
143144
import jakarta.validation.constraints.NotNull;
144145
145146
@Entity
@@ -152,7 +153,7 @@ import jakarta.validation.constraints.NotNull;
152153
public class Product {
153154
154155
@Id
155-
@GeneratedValue
156+
@GeneratedValue(strategy = GenerationType.IDENTITY)
156157
private Long id;
157158
158159
@NotNull
@@ -471,6 +472,7 @@ $ curl http://localhost:9080/mp-ecomm-store/api/products
471472
[source, java]
472473
----
473474
@DELETE
475+
@Transactional
474476
@Path("products/{id}")
475477
public Response deleteProduct(@PathParam("id") Long id) {
476478
// Delete a product

0 commit comments

Comments
 (0)