JPA in Spring Boot applications

Developers can use the Java Persistence API (JPA) to create object-oriented versions of relational database entities to use in their applications.

To use JPA in your Spring Boot application, first add a JPA artifact to your dependencies in your Spring Boot application. For example:
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

Java EE’s implementation of JPA and Spring data’s implementation of JPA both require configuration to define the connection to the database repository that is used by the application.

Just like using JDBC you can use the spring.datasource.jndi-name property that is defined in application.properties to configure the connection to the datasource being used and this will be used dynamically by the JPA EntityManager. Alternatively the data source can also be defined in an @Bean annotated dataSource() method, by performing a JNDI lookup of a data source defined in Liberty.