New Project Details
ArtifactId : WFJPA2PC
New Project Home : /home/oracle/NetBeansProjects/GIT/WFJPA2PC
New persistence.xml location : /home/oracle/NetBeansProjects/GIT/WFJPA2PC/src/main/resources/META-INF/persistence.xml Your old and working project should have a working pom.xml and persistence.xml
Modify and copy pom,xml
Modify artifactId and name in your pom.xml
<artifactId>WFJPA2PC</artifactId>
<name>WFJPA2PC</name>
Copy pom.xml to your new Project Folder
$ cp pom.xml /home/oracle/NetBeansProjects/GIT/WFJPA2PC
Add JSF support to our project
Project -> Properties -> Framework -> Add JavaServerFaces
-> Components -> PrimeFaces
Create new Entity Classes
Create new Entity Classes as needed [ in our sample we use Entity Class : Accounts
Source package -> New -> EnititY Class form Database
-> Select Datasource
-> Select Table Name : Accounts
-> Add
-> Finish
Create a new JPA persistence.xml and copy over the working persistence.xml
Netbeans : File -> NEW -> Persistence Unit
Locate your Persistence Location of persistence.xml:
/home/oracle/NetBeansProjects/GIT/WFJPA2PC/src/main/resources/META-INF/persistence.xml
-> Copy over your new RAC XA persistence.xml to src/main/resources/META-INF/persistence.xml
and add your newly created Entitly Classes
Sample for a Hibernate persistence.xml with Entity Class : Accounts
<?xml version="1.0"?>
<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="RacBankAHibPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jboss/datasources/xa_rac12g_banka</jta-data-source>
<class>com.hhu.wfjpa2pc.Accounts</class>
<properties>
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence>