rzo1 commented on a change in pull request #789:
URL: https://github.com/apache/tomee/pull/789#discussion_r629877489



##########
File path: examples/jpa-hibernate-arquillian/pom.xml
##########
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<!-- $Rev: 636494 $ $Date: 2008-03-12 21:24:02 +0100 (Wed, 12 Mar 2008) $ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.superbiz</groupId>
+  <artifactId>jpa-hibernate-arquillian</artifactId>
+  <packaging>jar</packaging>
+  <version>8.0.7-SNAPSHOT</version>
+  <name>TomEE :: Examples :: JPA with Hibernate and arquillian</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+     <tomee.version>8.0.7-SNAPSHOT</tomee.version>
+  </properties>
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.5.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.tomitribe.transformer</groupId>
+        <artifactId>org.eclipse.transformer.maven</artifactId>
+        <version>0.1.1a</version>
+        <configuration>
+          <classifier>jakartaee9</classifier>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <phase>package</phase>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <repositories>
+    <repository>
+      <id>apache-m2-snapshot</id>
+      <name>Apache Snapshot Repository</name>
+      <url>https://repository.apache.org/content/groups/snapshots</url>
+    </repository>
+    <repository>
+      <id>jboss-public-repository-group</id>
+      <name>JBoss Public Maven Repository Group</name>
+      
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
+      <layout>default</layout>
+      <releases>
+        <enabled>true</enabled>
+        <updatePolicy>always</updatePolicy>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+        <updatePolicy>always</updatePolicy>
+      </snapshots>
+    </repository>
+  </repositories>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Override dependency resolver with test version. This must go 
*BEFORE*
+              the Arquillian BOM. -->
+            <dependency>
+                <groupId>org.jboss.shrinkwrap.resolver</groupId>
+                <artifactId>shrinkwrap-resolver-bom</artifactId>
+                <version>3.1.4</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+            <!-- Now pull in our server-based unit testing framework -->
+            <dependency>
+                <groupId>org.jboss.arquillian</groupId>
+                <artifactId>arquillian-bom</artifactId>
+                <version>1.0.3.Final</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.tomee</groupId>
+      <artifactId>javaee-api</artifactId>
+      <version>[8.0,)</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+

Review comment:
       Looks like formatting is off-scale here?

##########
File path: examples/jpa-hibernate-arquillian/README.adoc
##########
@@ -0,0 +1,323 @@
+= JPA Hibernate Arquillian
+:index-group: JPA
+:jbake-type: page
+:jbake-status: published
+
+This example shows the persist, remove and creation a query in JPA Hibernate 5 
using arquillian for the test.
+
+The Java Persistence API (JPA) is a Java specification for accessing, 
persisting, and managing data between Java objects / classes and a relational 
database.
+
+To exemplify the use of JPA, we will persist an Object (Movie) in the database.
+
+Links to the documentation have been added in key parts of the example for the 
case of doubts and as a way to encourage their reading for details.
+
+== Movie
+
+Here we have a class with some details. See the annotation 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/Entity.html[@Entity]
 
+above the declaration, with it we are saying that this class is an entity (a 
table in the database). We still have two more annotations above the attribute 
id, one of them is 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/Id.html[@Id] 
+annotation, it indicates that this attribute is the identifier of the entity 
and the other annotation 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/GeneratedValue.html[@GeneratedValue]
 
+indicates that the unique identifier value generation of the entity will be 
managed by the persistence provider.
+
+[source,java]
+----
+package org.superbiz.injection.h3jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+@Entity
+public class Movie {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}
+----
+
+== Movies
+
+Now we have two important things: 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/PersistenceContext.html[@PersistenceContext]
 
+annotation and the 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+declaration.
+The 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+is the interface with the core methods of JPA like persist, remove, merge, 
find and others...
+We annotate the 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+with 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/PersistenceContext.html[@PersistenceContext],
 a persistence context is an entity management where  every persistence context 
associated with a persistence unit, we will create a persistence.xml soon for 
this.
+
+[source,java]
+----
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import javax.persistence.criteria.*;
+import javax.persistence.metamodel.EntityType;
+import java.util.List;
+
+@Stateful
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = 
PersistenceContextType.EXTENDED)
+    private EntityManager entityManager;
+
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+
+    public int count(String field, String searchTerm) {
+        CriteriaBuilder qb = entityManager.getCriteriaBuilder();
+        CriteriaQuery<Long> cq = qb.createQuery(Long.class);
+        Root<Movie> root = cq.from(Movie.class);
+        EntityType<Movie> type = 
entityManager.getMetamodel().entity(Movie.class);
+        cq.select(qb.count(root));
+        if (field != null && searchTerm != null && !"".equals(field.trim()) && 
!"".equals(searchTerm.trim())) {
+            Path<String> path = 
root.get(type.getDeclaredSingularAttribute(field.trim(), String.class));
+            Predicate condition = qb.like(path, "%" + searchTerm.trim() + "%");
+            cq.where(condition);
+        }
+        return entityManager.createQuery(cq).getSingleResult().intValue();
+    }
+
+}
+----
+
+== persistence.xml
+
+Here we define which database will persist our movies, and we perform other 
configurations such as: define a persistence-unit with the name movie-unit, 
followed by the definition of the JPA provider/implementation (in this case 
Hibernate 5) and we set some properties for hibernate 5:
+
+----
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence";
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
+             version="2.0">
+    <persistence-unit name="movie-unit">
+        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+        <jta-data-source>movieDatabase</jta-data-source>
+        <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+        <class>org.superbiz.injection.h3jpa.Movie</class>
+        <properties>
+            <property name="hibernate.hbm2ddl.auto" value="update"/>
+            <property name="hibernate.dialect" 
value="org.hibernate.dialect.HSQLDialect"/>
+            <property name="hibernate.show_sql" value="true"/>
+
+            <!--
+            JPA and CDI are linked, enabling JPA to use CDI for its
+            components but CDI can use JPA too. To solve issues with
+            hibernate you need to this property either as system property
+            or persistence unit
+            -->
+            <property name="tomee.jpa.factory.lazy" value="true"/>
+        </properties>
+    </persistence-unit>
+</persistence>
+----
+
+
+== arquillian.xml
+This file provides the configuration the server will have for running the 
tests.
+The property `additionalLibs` provide to the server the jar files required for 
Hibernate 5 as explained in the 
http://tomee.apache.org/latest/docs/tomee-and-hibernate.html[TomEE and 
Hibernate] documentation.

Review comment:
       Maybe use https instead of http for the external link. Sadly, the ASF 
page does no redirect for non http traffic.

##########
File path: examples/jpa-hibernate-arquillian/README.adoc
##########
@@ -0,0 +1,323 @@
+= JPA Hibernate Arquillian
+:index-group: JPA
+:jbake-type: page
+:jbake-status: published
+
+This example shows the persist, remove and creation a query in JPA Hibernate 5 
using arquillian for the test.

Review comment:
       This example shows the persist, remove and creation **of an entity** 
[...] 

##########
File path: examples/jpa-hibernate-arquillian/src/test/resources/arquillian.xml
##########
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian";
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+            xsi:schemaLocation="http://jboss.org/schema/arquillian 
http://jboss.org/schema/arquillian/arquillian_1_0.xsd";>
+    <container qualifier="tomee" default="true">
+        <configuration>
+            <property name="httpPort">-1</property>
+            <property name="ajpPort">-1</property>
+            <property name="stopPort">-1</property>
+            <property name="dir">target/tomee-remote</property>
+            <property 
name="appWorkingDir">target/arquillian-remote-working-dir</property>
+            <property name="cleanOnStartUp">true</property>
+            <property name="additionalLibs">
+                <!-- add hibernate 5 need it jars to the server-->
+                mvn:org.hibernate:hibernate-entitymanager:5.4.10.Final

Review comment:
       see above

##########
File path: examples/jpa-hibernate-arquillian/README.adoc
##########
@@ -0,0 +1,323 @@
+= JPA Hibernate Arquillian
+:index-group: JPA
+:jbake-type: page
+:jbake-status: published
+
+This example shows the persist, remove and creation a query in JPA Hibernate 5 
using arquillian for the test.
+
+The Java Persistence API (JPA) is a Java specification for accessing, 
persisting, and managing data between Java objects / classes and a relational 
database.
+
+To exemplify the use of JPA, we will persist an Object (Movie) in the database.
+
+Links to the documentation have been added in key parts of the example for the 
case of doubts and as a way to encourage their reading for details.
+
+== Movie
+
+Here we have a class with some details. See the annotation 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/Entity.html[@Entity]
 
+above the declaration, with it we are saying that this class is an entity (a 
table in the database). We still have two more annotations above the attribute 
id, one of them is 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/Id.html[@Id] 
+annotation, it indicates that this attribute is the identifier of the entity 
and the other annotation 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/GeneratedValue.html[@GeneratedValue]
 
+indicates that the unique identifier value generation of the entity will be 
managed by the persistence provider.
+
+[source,java]
+----
+package org.superbiz.injection.h3jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+@Entity
+public class Movie {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}
+----
+
+== Movies
+
+Now we have two important things: 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/PersistenceContext.html[@PersistenceContext]
 
+annotation and the 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+declaration.
+The 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+is the interface with the core methods of JPA like persist, remove, merge, 
find and others...
+We annotate the 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+with 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/PersistenceContext.html[@PersistenceContext],
 a persistence context is an entity management where  every persistence context 
associated with a persistence unit, we will create a persistence.xml soon for 
this.
+
+[source,java]
+----
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import javax.persistence.criteria.*;
+import javax.persistence.metamodel.EntityType;
+import java.util.List;
+
+@Stateful
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = 
PersistenceContextType.EXTENDED)
+    private EntityManager entityManager;
+
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+
+    public int count(String field, String searchTerm) {
+        CriteriaBuilder qb = entityManager.getCriteriaBuilder();
+        CriteriaQuery<Long> cq = qb.createQuery(Long.class);
+        Root<Movie> root = cq.from(Movie.class);
+        EntityType<Movie> type = 
entityManager.getMetamodel().entity(Movie.class);
+        cq.select(qb.count(root));
+        if (field != null && searchTerm != null && !"".equals(field.trim()) && 
!"".equals(searchTerm.trim())) {
+            Path<String> path = 
root.get(type.getDeclaredSingularAttribute(field.trim(), String.class));
+            Predicate condition = qb.like(path, "%" + searchTerm.trim() + "%");
+            cq.where(condition);
+        }
+        return entityManager.createQuery(cq).getSingleResult().intValue();
+    }
+
+}
+----
+
+== persistence.xml
+
+Here we define which database will persist our movies, and we perform other 
configurations such as: define a persistence-unit with the name movie-unit, 
followed by the definition of the JPA provider/implementation (in this case 
Hibernate 5) and we set some properties for hibernate 5:
+
+----
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence";
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
+             version="2.0">
+    <persistence-unit name="movie-unit">
+        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+        <jta-data-source>movieDatabase</jta-data-source>

Review comment:
       Might be worth adding a link to the documentation for `resources.xml` or 
`tomee.xml` to define a datasource here, wdyt?

##########
File path: examples/jpa-hibernate-arquillian/README.adoc
##########
@@ -0,0 +1,323 @@
+= JPA Hibernate Arquillian
+:index-group: JPA
+:jbake-type: page
+:jbake-status: published
+
+This example shows the persist, remove and creation a query in JPA Hibernate 5 
using arquillian for the test.
+
+The Java Persistence API (JPA) is a Java specification for accessing, 
persisting, and managing data between Java objects / classes and a relational 
database.
+
+To exemplify the use of JPA, we will persist an Object (Movie) in the database.
+
+Links to the documentation have been added in key parts of the example for the 
case of doubts and as a way to encourage their reading for details.
+
+== Movie
+
+Here we have a class with some details. See the annotation 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/Entity.html[@Entity]
 
+above the declaration, with it we are saying that this class is an entity (a 
table in the database). We still have two more annotations above the attribute 
id, one of them is 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/Id.html[@Id] 
+annotation, it indicates that this attribute is the identifier of the entity 
and the other annotation 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/GeneratedValue.html[@GeneratedValue]
 
+indicates that the unique identifier value generation of the entity will be 
managed by the persistence provider.
+
+[source,java]
+----
+package org.superbiz.injection.h3jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+@Entity
+public class Movie {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}
+----
+
+== Movies
+
+Now we have two important things: 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/PersistenceContext.html[@PersistenceContext]
 
+annotation and the 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+declaration.
+The 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+is the interface with the core methods of JPA like persist, remove, merge, 
find and others...
+We annotate the 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/EntityManager.html[EntityManager]
 
+with 
+link:https://tomee.apache.org/tomee-8.0/javadoc/javax/persistence/PersistenceContext.html[@PersistenceContext],
 a persistence context is an entity management where  every persistence context 
associated with a persistence unit, we will create a persistence.xml soon for 
this.
+
+[source,java]
+----
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import javax.persistence.criteria.*;
+import javax.persistence.metamodel.EntityType;
+import java.util.List;
+
+@Stateful
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = 
PersistenceContextType.EXTENDED)
+    private EntityManager entityManager;
+
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+
+    public int count(String field, String searchTerm) {
+        CriteriaBuilder qb = entityManager.getCriteriaBuilder();
+        CriteriaQuery<Long> cq = qb.createQuery(Long.class);
+        Root<Movie> root = cq.from(Movie.class);
+        EntityType<Movie> type = 
entityManager.getMetamodel().entity(Movie.class);
+        cq.select(qb.count(root));
+        if (field != null && searchTerm != null && !"".equals(field.trim()) && 
!"".equals(searchTerm.trim())) {
+            Path<String> path = 
root.get(type.getDeclaredSingularAttribute(field.trim(), String.class));
+            Predicate condition = qb.like(path, "%" + searchTerm.trim() + "%");
+            cq.where(condition);
+        }
+        return entityManager.createQuery(cq).getSingleResult().intValue();
+    }
+
+}
+----
+
+== persistence.xml
+
+Here we define which database will persist our movies, and we perform other 
configurations such as: define a persistence-unit with the name movie-unit, 
followed by the definition of the JPA provider/implementation (in this case 
Hibernate 5) and we set some properties for hibernate 5:
+
+----
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence";
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
+             version="2.0">
+    <persistence-unit name="movie-unit">
+        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+        <jta-data-source>movieDatabase</jta-data-source>
+        <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+        <class>org.superbiz.injection.h3jpa.Movie</class>
+        <properties>
+            <property name="hibernate.hbm2ddl.auto" value="update"/>
+            <property name="hibernate.dialect" 
value="org.hibernate.dialect.HSQLDialect"/>
+            <property name="hibernate.show_sql" value="true"/>
+
+            <!--
+            JPA and CDI are linked, enabling JPA to use CDI for its
+            components but CDI can use JPA too. To solve issues with
+            hibernate you need to this property either as system property
+            or persistence unit
+            -->
+            <property name="tomee.jpa.factory.lazy" value="true"/>
+        </properties>
+    </persistence-unit>
+</persistence>
+----
+
+
+== arquillian.xml
+This file provides the configuration the server will have for running the 
tests.
+The property `additionalLibs` provide to the server the jar files required for 
Hibernate 5 as explained in the 
http://tomee.apache.org/latest/docs/tomee-and-hibernate.html[TomEE and 
Hibernate] documentation.
+
+
+----
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<arquillian xmlns="http://jboss.org/schema/arquillian";
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+            xsi:schemaLocation="http://jboss.org/schema/arquillian 
http://jboss.org/schema/arquillian/arquillian_1_0.xsd";>
+    <container qualifier="tomee" default="true">
+        <configuration>
+            <property name="httpPort">-1</property>
+            <property name="ajpPort">-1</property>
+            <property name="stopPort">-1</property>
+            <property name="dir">target/tomee-remote</property>
+            <property 
name="appWorkingDir">target/arquillian-remote-working-dir</property>
+            <property name="cleanOnStartUp">true</property>
+            <property name="additionalLibs">
+                <!-- add hibernate 5 need it jars to the server-->

Review comment:
       Question: Shouldn't we go for `5.4.31.Final` here as it contains several 
(query) related bug fixes since `5.4.10.Final` (just in case a user is going to 
simply CnP the example) ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to