For starters, NetBeans provides a wizard for generating a Persistence Unit for a project. Simply right-click on a project, choose "New" from the context menu, and then choose the "Persistence"->"Persistence Unit" option.
Next, supply a name for your Persistence Unit, along with a Persistence Provider using the drop-down menu of selections. You can then choose from an available Data Source, and choose a table generation strategy.
Once created, the Persistence Unit can be found within the "Configuration Files" folder of a NetBeans project.
Selecting and double-clicking the file will open the Persistence Unit editor. NetBeans provides an easy to modify configuration screen for the Persistence Unit that allows changes to be made without working directly with XML.
For instance, one may wish to add an entity class for use with the Persistence Unit. To do so, simply click the "Add Class" button and choose the desired class(es).
If you'd rather work directly with the XML of a Persistence Unit, choose the "Source" button at the top of the editor. Rather than seeing drab XML, you will be presented with color-coded and an auto-completing XML document.
Working with history is a breeze with the Persistence Unit configuration within NetBeans. Choose the "History" button at the top of the editor to see a listing of all changes made to the unit, and it also provides diffs so you can easily see the changes that have been made, and/or apply or revert code, as needed.
NetBeans provides and easy way to work with Persistence Units. Forget about dealing with XML within a text editor...you'll never want to do that again.