Workshop includes form editors to manage the JPA configuration file and includes wizards to add new content. The persistence.xml file defines a context for JPA. This context can include information about the underlying persistence provider, the database connection to use, vendor-specific properties to set, and so on. The persistence.xml file is typically located at this path in your project hierarchy:
Workshop provides a graphical interface for editing the persistence.xml file, as well as statement completion for those times when you want to edit the XML file directly. Graphical views on persistence.xml data also include a "source view" of the XML.
You start editing the persistence.xml file by right-clicking on JPA Configuration, then clicking Open.
You can also open the persistence.xml file by double-clicking it in AppXplorer.
Once it's open, you'll notice that the persistence.xml editor has four tabs:
Use the Connection tab to edit the database connection. Click Edit Connection Properties to display the Connection Properties dialog. There, you can edit the existing properties or grab properties from another connection to use instead.
By clicking Populate from existing connection, you can use a connection that you've already set up using DbXplorer. Note that if requested, Workshop will copy the database driver library and add it to your classpath, where it will be available to your persistence code.
You can add, remove and edit JPA entity beans using the Mappings tab. Click the Class Name link to view the source code for the selected mapped class.
Use the Properties tab to edit configuration properties, such as vendor-specific information. In the following example, the EJB3 provider is Hibernate. Note that when you add a new property, you can browse from among the properties exposed by the provider.
Of course, you can always edit the persistence.xml source directly. When you're editing in the Source tab, you're helped by statement completion, as shown in the following illustrations.
Creating a new child element of
Adding a new
Generating JPA Mappings
Managing EJB3 Entity Relationships