Tutorial - Set Up A Web Dynamic Project As JPA
Tutorial - Set Up A Web Dynamic Project As JPA
Tutorial - Set Up A Web Dynamic Project As JPA
In this tutorial we are going to follow the steps required for the second option: we will
take an existing “Dynamic Web” project and we will convert it into a JPA project. We
will use a DataSource previously created to connect with the database.
otherwise, once created, right click on the project and click on properties>Project Facets
1. Right click on the laboratories project and select : Configure-> JPA project to
convert ...
2. In the dialog that appears make sure that Payara is selected as Runtime
3. Press Next in the following screen select in JPA implementation: Payara System
Library
Window>Perspective>Open Perspective>JPA
4. Press Finish and it will generate a new persistence.xml descriptor within a
META-INF directory. Open it with a double click.
it's in the JPA Content dir
6. At the bottom of the editor changes the Connection tab and apply the following
values
Nombre del
DataSource
7. Save changes
You should have a code that looks like the following (by clicking on the source tab):
Now you can start adding entities to your project. You will see that as you add them
they name will appear in the file persistence.xml.