You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2022/05/06 08:38:59 UTC

[tomee] branch master updated: TOMEE-3943 - Fix TomEE :: Examples :: Multiple JPA providers Hibernate 6 requires a Jsonb Provider at runtime. We need to define Johnzon via SPI here to ensure that Hibernate comes up

This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/master by this push:
     new efcbcf306c TOMEE-3943 - Fix TomEE :: Examples :: Multiple JPA providers Hibernate 6 requires a Jsonb Provider at runtime. We need to define Johnzon via SPI here to ensure that Hibernate comes up
efcbcf306c is described below

commit efcbcf306cbd07924ac713a1cf05e2ba8a9f3386
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Fri May 6 10:38:49 2022 +0200

    TOMEE-3943 - Fix TomEE :: Examples :: Multiple JPA providers
    Hibernate 6 requires a Jsonb Provider at runtime. We need to define Johnzon via SPI here to ensure that Hibernate comes up
---
 examples/multi-jpa-provider-testing/pom.xml        | 17 +++++++----
 .../services/jakarta.json.bind.spi.JsonbProvider   |  1 +
 .../src/test/resources/hibernate-pom.xml           | 33 ++++++++++------------
 .../src/test/resources/openjpa-pom.xml             | 13 ++-------
 4 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/examples/multi-jpa-provider-testing/pom.xml b/examples/multi-jpa-provider-testing/pom.xml
index 8a898b797e..b717127354 100644
--- a/examples/multi-jpa-provider-testing/pom.xml
+++ b/examples/multi-jpa-provider-testing/pom.xml
@@ -33,17 +33,17 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.5.1</version>
+        <version>3.10.1</version>
         <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
+          <source>11</source>
+          <target>11</target>
         </configuration>
       </plugin>
       <plugin>
         <!-- run tests twice, once with openjpa and once with hibernate -->
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.18.1</version>
+        <version>3.0.0-M6</version>
         <executions>
           <execution>
             <id>test-hibernate</id>
@@ -56,6 +56,7 @@
               <systemPropertyVariables>
                 <jakarta.persistence.provider>org.hibernate.jpa.HibernatePersistenceProvider</jakarta.persistence.provider>
                 <tomee.jpa.factory.lazy>true</tomee.jpa.factory.lazy>
+                <hibernate.type.json_format_mapper>jsonb</hibernate.type.json_format_mapper>
               </systemPropertyVariables>
             </configuration>
           </execution>
@@ -65,7 +66,7 @@
             <goals>
               <goal>test</goal>
             </goals>
-            <configuration>
+            <configuration>FormatMapper
               <skip>${maven.test.skip}</skip>
               <argLine>"-javaagent:${settings.localRepository}/org/apache/tomee/openejb-javaagent/${tomee.version}/openejb-javaagent-${tomee.version}.jar"</argLine>
               <systemPropertyVariables>
@@ -155,6 +156,12 @@
       <scope>test</scope>
       <type>pom</type>
     </dependency>
+    <dependency>
+      <groupId>org.apache.tomee.bom</groupId>
+      <artifactId>tomee-webprofile</artifactId>
+      <version>${tomee.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <!-- This section allows you to configure where to publish libraries for
  sharing. It is not required and may be deleted. For more information see:
diff --git a/examples/multi-jpa-provider-testing/src/main/resources/META-INF/services/jakarta.json.bind.spi.JsonbProvider b/examples/multi-jpa-provider-testing/src/main/resources/META-INF/services/jakarta.json.bind.spi.JsonbProvider
new file mode 100644
index 0000000000..821d9424bb
--- /dev/null
+++ b/examples/multi-jpa-provider-testing/src/main/resources/META-INF/services/jakarta.json.bind.spi.JsonbProvider
@@ -0,0 +1 @@
+org.apache.johnzon.jsonb.JohnzonProvider
\ No newline at end of file
diff --git a/examples/multi-jpa-provider-testing/src/test/resources/hibernate-pom.xml b/examples/multi-jpa-provider-testing/src/test/resources/hibernate-pom.xml
index da753d3e76..2d35d3fe3a 100644
--- a/examples/multi-jpa-provider-testing/src/test/resources/hibernate-pom.xml
+++ b/examples/multi-jpa-provider-testing/src/test/resources/hibernate-pom.xml
@@ -25,32 +25,29 @@
 
   <dependencies>
     <dependency>
-      <groupId>org.hibernate</groupId>
-      <artifactId>hibernate-entitymanager</artifactId>
-      <version>4.1.8.Final</version>
+      <groupId>org.hibernate.orm</groupId>
+      <artifactId>hibernate-core</artifactId>
+      <version>6.0.0.Final</version>
       <exclusions>
         <exclusion>
-          <groupId>org.hibernate.jakarta.persistence</groupId>
-          <artifactId>hibernate-jpa-2.0-api</artifactId>
+          <groupId>jakarta.persistence</groupId>
+          <artifactId>*</artifactId>
         </exclusion>
         <exclusion>
-          <groupId>org.jboss.spec.jakarta.transaction</groupId>
-          <artifactId>jboss-transaction-api_1.1_spec</artifactId>
+          <groupId>jakarta.transaction</groupId>
+          <artifactId>*</artifactId>
         </exclusion>
         <exclusion>
-          <groupId>org.javassist</groupId>
-          <artifactId>javassist</artifactId>
+          <groupId>jakarta.activation</groupId>
+          <artifactId>*</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>jakarta.xml.bind</groupId>
+          <artifactId>*</artifactId>
         </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.hibernate</groupId>
-      <artifactId>hibernate-validator</artifactId>
-      <version>4.3.0.Final</version>
-      <exclusions>
         <exclusion>
-          <groupId>jakarta.validation</groupId>
-          <artifactId>validation-api</artifactId>
+          <groupId>jakarta.inject</groupId>
+          <artifactId>*</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
diff --git a/examples/multi-jpa-provider-testing/src/test/resources/openjpa-pom.xml b/examples/multi-jpa-provider-testing/src/test/resources/openjpa-pom.xml
index 70b7903cdf..104905ceaf 100644
--- a/examples/multi-jpa-provider-testing/src/test/resources/openjpa-pom.xml
+++ b/examples/multi-jpa-provider-testing/src/test/resources/openjpa-pom.xml
@@ -27,20 +27,13 @@
     <dependency>
       <groupId>org.apache.openjpa</groupId>
       <artifactId>openjpa</artifactId>
-      <version>2.2.0</version>
+      <version>3.2.2</version>
+      <classifier>jakarta</classifier>
       <exclusions>
         <exclusion>
-          <groupId>org.apache.geronimo.specs</groupId>
+          <groupId>*</groupId>
           <artifactId>*</artifactId>
         </exclusion>
-        <exclusion>
-          <groupId>com.sun.xml.bind</groupId>
-          <artifactId>jaxb-impl</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>jakarta.xml.bind</groupId>
-          <artifactId>jaxb-api</artifactId>
-        </exclusion>
       </exclusions>
     </dependency>
   </dependencies>