Created
March 6, 2023 15:18
-
-
Save aerphanas/274322a3539b714fac24fc99254be406 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From e8bbace06f13e4d519396d604b93432a845a3bd8 Mon Sep 17 00:00:00 2001 | |
| From: Muhammad Aviv Burhanudin <muhamadaviv14@gmail.com> | |
| Date: Mon, 6 Mar 2023 22:16:55 +0700 | |
| Subject: [PATCH] fix connection | |
| Signed-off-by: Muhammad Aviv Burhanudin <muhamadaviv14@gmail.com> | |
| --- | |
| rest-json-quickstart/pom.xml | 8 ++++++++ | |
| rest-json-quickstart/src/main/java/Product.java | 3 +++ | |
| rest-json-quickstart/src/main/java/ProductResource.java | 5 +---- | |
| 3 files changed, 12 insertions(+), 4 deletions(-) | |
| diff --git a/rest-json-quickstart/pom.xml b/rest-json-quickstart/pom.xml | |
| index 059ec0c..ca9dbdb 100644 | |
| --- a/rest-json-quickstart/pom.xml | |
| +++ b/rest-json-quickstart/pom.xml | |
| @@ -36,6 +36,14 @@ | |
| <groupId>io.quarkus</groupId> | |
| <artifactId>quarkus-arc</artifactId> | |
| </dependency> | |
| + <dependency> | |
| + <groupId>io.quarkus</groupId> | |
| + <artifactId>quarkus-jdbc-postgresql</artifactId> | |
| + </dependency> | |
| + <dependency> | |
| + <groupId>io.quarkus</groupId> | |
| + <artifactId>quarkus-hibernate-orm-panache</artifactId> | |
| + </dependency> | |
| <dependency> | |
| <groupId>io.quarkus</groupId> | |
| <artifactId>quarkus-junit5</artifactId> | |
| diff --git a/rest-json-quickstart/src/main/java/Product.java b/rest-json-quickstart/src/main/java/Product.java | |
| index d5b7999..832753c 100644 | |
| --- a/rest-json-quickstart/src/main/java/Product.java | |
| +++ b/rest-json-quickstart/src/main/java/Product.java | |
| @@ -9,6 +9,9 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; | |
| @Table(name = "product", schema="product") | |
| public class Product extends PanacheEntityBase { | |
| + public Product() { | |
| + } | |
| + | |
| @Id | |
| @Column(name = "name") | |
| public String name; | |
| diff --git a/rest-json-quickstart/src/main/java/ProductResource.java b/rest-json-quickstart/src/main/java/ProductResource.java | |
| index 5d57134..dc725b5 100644 | |
| --- a/rest-json-quickstart/src/main/java/ProductResource.java | |
| +++ b/rest-json-quickstart/src/main/java/ProductResource.java | |
| @@ -18,9 +18,6 @@ import javax.inject.Inject; | |
| @Consumes(MediaType.APPLICATION_JSON) | |
| public class ProductResource { | |
| - @Inject | |
| - Product entity ; | |
| - | |
| @GET | |
| public List<PanacheEntityBase> getAll() { | |
| return Product.listAll(); | |
| @@ -58,7 +55,7 @@ public class ProductResource { | |
| if (p == null) { | |
| return Response.status(Response.Status.NOT_FOUND).build(); | |
| } | |
| - entity.delete(); | |
| + p.delete(); | |
| return Response.noContent().build(); | |
| } | |
| -- | |
| 2.39.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment