Configuring JPA

Now, let’s add a dependency for MySQL in the project. Refer to Figure 4.11 in Chapter 4, Creating JEE Database Applications, for adding a Maven dependency for the MySQL JDBC driver, or simply add the following dependency to pom.xml:

<dependency>  <groupId>mysql</groupId>  <artifactId>mysql-connector-java</artifactId>  <version>8.0.8-dmr</version></dependency>

Convert the project to a JPA project so that we can use the JPA tooling provided by Eclipse. Right-click on the project in the Project Explorer and select the Configure | Convert to JPA Project option. Make sure the following Project Facets are selected, along with the default facets:

  • Dynamic Web Module
  • JAX-RS (RESTful web services)
  • JPA

Click the Next button (refer to ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.