This project demonstrates core JPA Entity Relationships such as:
@OneToOne
@ManyToOne
@OneToMany
@ManyToMany
No external relational database setup is required.
- Uses H2 in-memory database (lightweight ~2MB footprint)
- Fully supports both JDBC and R2DBC access
- Ideal for rapid prototyping, unit testing, and learning purposes
You can insert sample data into various JPA entity relationships using the following API endpoints. Sample JSON payloads are available here.
-
POST /api/emp/create
Inserts data into a@OneToOne
relationship. -
POST /api/tchr/create
Insert data into@OneToMany
relationship.👉 Data is automatically populated at startup using a
CommandLineRunner
. -
POST /api/movie/create
Inserts data into a@ManyToMany
relationship.
- The application starts on port
8082
by default. - You can change the port configuration in
application.properties
.
- Spring Boot
- Spring Data JPA with Hibernate
- H2
- Git 2.24.0
- IntelliJ IDEA 2021.1.1.1
- Gradle