From d0fb047d5444750c607019ff677d89402ae238e8 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Thu, 14 Apr 2022 16:08:31 -0700 Subject: [PATCH 1/3] Fix deps in jpa examples and do other cleanup --- etc/copyright-exclude.txt | 3 ++- examples/integrations/cdi/jpa/pom.xml | 23 +++++++++--------- .../main/resources/META-INF/persistence.xml | 8 +++---- examples/integrations/cdi/pokemons/README.md | 10 ++++++++ examples/integrations/cdi/pokemons/pom.xml | 24 ++++++++++--------- .../main/resources/META-INF/init_script.sql | 16 ------------- .../main/resources/META-INF/persistence.xml | 8 +++---- 7 files changed, 44 insertions(+), 48 deletions(-) diff --git a/etc/copyright-exclude.txt b/etc/copyright-exclude.txt index 1ea72b83588..0fae0141c19 100644 --- a/etc/copyright-exclude.txt +++ b/etc/copyright-exclude.txt @@ -24,6 +24,7 @@ .MD .p12 .txt +.sql jaxb.index /MANIFEST.MF /README @@ -53,4 +54,4 @@ target/ .git/ META-INF/services/ persistence_3_0.xjb -persistence_3_0.xsd \ No newline at end of file +persistence_3_0.xsd diff --git a/examples/integrations/cdi/jpa/pom.xml b/examples/integrations/cdi/jpa/pom.xml index 3e14abea335..e4a2d1ab8a6 100644 --- a/examples/integrations/cdi/jpa/pom.xml +++ b/examples/integrations/cdi/jpa/pom.xml @@ -1,7 +1,7 @@ - - jakarta.persistence - jakarta.persistence-api - provided - - - jakarta.transaction - jakarta.transaction-api - provided - @@ -125,6 +114,16 @@ jakarta.ws.rs-api compile + + jakarta.persistence + jakarta.persistence-api + compile + + + jakarta.transaction + jakarta.transaction-api + compile + diff --git a/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml b/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml index 958d819711a..04944436a7f 100644 --- a/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml +++ b/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence + https://jakarta.ee/xml/ns/persistence/persistence_2_2.xsd"> test io.helidon.examples.integrations.cdi.jpa.Greeting diff --git a/examples/integrations/cdi/pokemons/README.md b/examples/integrations/cdi/pokemons/README.md index 66e9900aa24..513acbfbea6 100644 --- a/examples/integrations/cdi/pokemons/README.md +++ b/examples/integrations/cdi/pokemons/README.md @@ -6,6 +6,16 @@ mvn package java -jar target/helidon-integrations-examples-pokemons-jpa.jar ``` +## Exercise the application + +``` +curl -X GET http://localhost:8080/pokemon +[{"id":1,"type":12,"name":"Bulbasaur"}, ...] +curl -X GET http://localhost:8080/type +[{"id":1,"name":"Normal"}, ...] +curl -H "Content-Type: application/json" --request POST --data '{"id":100, "type":1, "name":"Test"}' http://localhost:8080/pokemon +``` + --- Pokémon, and Pokémon character names are trademarks of Nintendo. diff --git a/examples/integrations/cdi/pokemons/pom.xml b/examples/integrations/cdi/pokemons/pom.xml index 4c4570ea6fa..6b258421b4c 100644 --- a/examples/integrations/cdi/pokemons/pom.xml +++ b/examples/integrations/cdi/pokemons/pom.xml @@ -1,7 +1,7 @@ @@ -106,17 +115,10 @@ microprofile-config-api runtime - - - - jakarta.persistence - jakarta.persistence-api - provided - - jakarta.transaction - jakarta.transaction-api - provided + io.helidon.microprofile.bean-validation + helidon-microprofile-bean-validation + runtime diff --git a/examples/integrations/cdi/pokemons/src/main/resources/META-INF/init_script.sql b/examples/integrations/cdi/pokemons/src/main/resources/META-INF/init_script.sql index e16c4b659b6..8d3d00c78ae 100644 --- a/examples/integrations/cdi/pokemons/src/main/resources/META-INF/init_script.sql +++ b/examples/integrations/cdi/pokemons/src/main/resources/META-INF/init_script.sql @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2020 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - INSERT INTO POKEMONTYPE VALUES (1, 'Normal'); INSERT INTO POKEMONTYPE VALUES (2, 'Fighting'); INSERT INTO POKEMONTYPE VALUES (3, 'Flying'); diff --git a/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml b/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml index aa03db6e5a4..5a34fba5124 100644 --- a/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml +++ b/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence + https://jakarta.eee/xml/ns/persistence/persistence_2_2.xsd"> test io.helidon.examples.integrations.cdi.pokemon.Pokemon From cb36b588a5c6d18df95170af0df4861c14f756ea Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Thu, 14 Apr 2022 16:52:26 -0700 Subject: [PATCH 2/3] Switched from helidon-microprofile-bean-validation to just hibernate-validator --- examples/integrations/cdi/pokemons/pom.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/integrations/cdi/pokemons/pom.xml b/examples/integrations/cdi/pokemons/pom.xml index 6b258421b4c..8327868ee98 100644 --- a/examples/integrations/cdi/pokemons/pom.xml +++ b/examples/integrations/cdi/pokemons/pom.xml @@ -116,8 +116,13 @@ runtime - io.helidon.microprofile.bean-validation - helidon-microprofile-bean-validation + org.hibernate.validator + hibernate-validator-cdi + runtime + + + org.glassfish + jakarta.el runtime From 3f836c5bcea38c059619d4f75a0de3a11b464c10 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Fri, 15 Apr 2022 07:58:55 -0700 Subject: [PATCH 3/3] Update persistence.xml schema version to 3.0 --- .../cdi/jpa/src/main/resources/META-INF/persistence.xml | 4 ++-- .../cdi/pokemons/src/main/resources/META-INF/persistence.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml b/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml index 04944436a7f..64cb7796330 100644 --- a/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml +++ b/examples/integrations/cdi/jpa/src/main/resources/META-INF/persistence.xml @@ -16,11 +16,11 @@ limitations under the License. --> - + https://jakarta.ee/xml/ns/persistence/persistence_3.0.xsd"> test io.helidon.examples.integrations.cdi.jpa.Greeting diff --git a/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml b/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml index 5a34fba5124..5545d72aca2 100644 --- a/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml +++ b/examples/integrations/cdi/pokemons/src/main/resources/META-INF/persistence.xml @@ -16,11 +16,11 @@ limitations under the License. --> - + https://jakarta.eee/xml/ns/persistence/persistence_3.0.xsd"> test io.helidon.examples.integrations.cdi.pokemon.Pokemon