From the course: Creating Your First Spring Boot Microservice

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The JPA entities

The JPA entities

From the course: Creating Your First Spring Boot Microservice

Start my 1-month free trial

The JPA entities

- [Instructor] Now that we've established the business objects in the domain model, let's see the associated code. We're in a domain package, which is a new package that I've declared here. There is a class called Tour. As I said before this tutorial is for developers with previous knowledge of the Java Persistence API. For a quick overview of JPA check out the JPA chapter in my course Spring Data II. If you do know JPA then you will recognize the @Entity, @ID, @GeneratedValue, @Column, and @ManyToOne. These are annotations on this Java class and it's attributes. All the attributes in this class are present here, plus the generated ID field. In addition to the typical getters and setters, there is a constructor. This constructor is on line 50. It takes all the fields and initialize the attributes of those fields. I make my default constructor protected, so consumers of this class are only able to construct the…

Contents