0Pricing
Spring Boot 4 Microservices & REST APIs · Lesson

Creating Entities & Repositories

Define JPA entities to represent your data model and use Spring Data repositories for data access.

What are JPA Entities?

Welcome to creating your data model! In Spring Boot with JPA, an Entity is a plain Java object that represents a table in your database.

Think of it as a blueprint for the rows in your table. Each instance of an entity class corresponds to a single row in the database table.

Marking a Class as an Entity

To tell Spring Boot that a Java class is an entity, we use the @Entity annotation. This annotation comes from the Java Persistence API (JPA).

When Spring sees @Entity, it knows to map this class to a database table. By default, the table name will be the same as the class name (e.g., a Product class maps to a Product table).

All lessons in this course

  1. Integrating H2 Database & JPA
  2. Introduction to Spring Data JPA
  3. Creating Entities & Repositories
  4. Defining Entities & Repositories
  5. CRUD Operations with REST
  6. Performing CRUD Operations
← Back to Spring Boot 4 Microservices & REST APIs