Java Reference
In-Depth Information
When you have learned how to get help using Forge, let's get back to our application.
In the first step, we need to specify what Java and Java EE version we want to use:
[forge-demo]$ project-set-compiler-version --sourceVersion
1.8 --targetVersion 1.8
[forge-demo]$ javaee-setup --javaEEVersion 7
***SUCCESS*** JavaEE 7 has been installed.
At this point, our project already contains Java EE 7 API dependency. Now, since we will
need to reverse-engineer our database table into Java entities, the next step will be to con-
figure the Java Persistence API ( JPA ) layer for your application. This application will be
based on WildFly JPA implementation, which is based on the Hibernate provider, referen-
cing a database named Forge. This database is reachable at the Java Naming and Direct-
ory Interface ( JNDI ) named java:jboss/datasources/PostgreSqlDS . This is
shown in the following command line:
[forge-demo]$ jpa-setup --jpaVersion 2.1 --provider
HIBERNATE --container WILDFLY --dbType POSTGRES
--dataSourceName java:jboss/datasources/PostgreSqlDS
The persistence.xml file was generated, and currently the console indicates that we
are editing it. We can check its content by using the cat command:
[persistence.xml]$ cat .
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/
persistence" xmlns:xsi="http://w
ww.w3.org/2001/XMLSchema-instance" version="2.1"
xsi:schemaLocation="http://xmln
s.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/
persistence/persistence
_2_1.xsd">
<persistence-unit name="forge-demo-persistence-unit"
transaction-type="JTA">
<description>Forge Persistence Unit</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/
Search WWH ::




Custom Search