Creating the entity classes

An entity class is a simple Java class that is annotated with JPA's  @Entity annotation. Entity classes use the standard JavaBean naming convention and have proper getter and setter methods. The class fields have private visibility.

JPA creates a database table called the name of the class when the application is initialized. If you want to use some other name for the database table, you can use the @Table annotation.

To be able to use JPA and the H2 database, we have to add the following dependencies to the pom.xml file:

    <dependency>      <groupId>org.springframework.boot</groupId>      <artifactId>spring-boot-starter-data-jpa</artifactId>    </dependency>    <dependency>        <groupId>com.h2database</groupId> <artifactId>h2</artifactId> ...

Get Hands-On Full Stack Development with Spring Boot 2.0 and React 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.