O'Reilly logo

Java EE 7 Developer Handbook by Peter A. Pilgrim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Java EE 7 Persistence

This appendix covers miscellaneous topics on Java Persistence.

Persistence unit

The persistence.xml file is a simple XML deployment descriptor file that defines a persistence unit. This file configures the name of the EntityManager service, which manages a set of entity instances. The XML configuration also defines how each EntityManager connects to the database. A persistence unit may declare one or more uniquely named EntityManager instances.

The root element of the persistence.xml file is the persistence XML element and it contains a set of persistence-unit XML complex elements.

Here is a simple declaration of persistence.xml for JPA 2.1:

<persistence version=""2.1"" xmlns=""http://xmlns.jcp.org/xml/ns/persistence"" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required