Java Persistence API (JPA) is a standard JavaEE API for developing applications that need access to relational databases.


To use JPA in your application, you need to add the JPA dependency:


and then specify the dependency for whichever JDBC Driver you need for your particular database.

Examples include:

H2 JDBC Driver




Postgres JDBC Driver



The jpa fraction makes the JPA APIs available to your application through a transitive dependency. There is no need to add them yourself.

Usage in a WAR Application

By default, inclusion of the jpa fraction will cause the creation of the default ExampleDS datasource for usage by your persistence.xml. The datasource is bound as the default datasource, so there is no need to reference it by name from your persistence.xml.

Usage in a JAR application

If you have a .jar-based application with a main(…​), you can configure multiple datasources for usage with JPA.

Please see the Datasources chapter for details on configuring datasources.


If the default datasource for JPA is used, it may be configured using system properties.

Property Description


JDBC connection URL


Username for authenticating the connection


Password for authenticating the connection

Simple name of the datasource, such as ExampleDS