This is a simple spring boot JPA (hibernate) example. It will demonstrate how one to many, many to one mapping can be done
Below are the tables created in MySQL
create table department
(
department_id int not null auto_increment,primary key (department_id),
department_name varchar(50) not null
);
create table employee
(
employee_id int not null auto_increment, primary key (employee_id),
employee_name varchar(50) not null,
department_id int not null, foreign key (department_id) references department(department_id)
);
pom.xml
application.yml
Department.java
EmployeeRepository.java
EmployeeRepository.java
DepartmentRepository.java
Application.java