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

Configuration of persistence and the entity beans

In order to use JPA in a Java application, the entity beans require configuration for the data source and the persistence context. The persistence context is a file named persistence.xml, and it is found in the META-INF/ folder of Java Archive.

The structure of the persistence unit configuration

A persistence configuration XML file defines a collection of the persistence units. There must be at least one persistence unit in the file for it to be useful. A persistence unit represents a persistence context in the application, and it has a name. The name is used in an application to link EntityManager with the persistence unit. The linkage is defined with the @PersistenceContext annotation.

A 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