1)PFB the link reference for basic spring boot projects and concepts,
2)In a one-to-many relationship, one record in a table can be associated with one records in another table.
2.1)It helps to link with 2 tables contains primary key and foreign key.
2.2)@OneToOne annotation automatically creates the foreign key in child table and represents the link between 2 tables.
2.3)It ensures the link between parent table having one data has linked with child table having another one data.
Parent table:
3.1)This base entity is an abstract class and it only contains common parameters for all tables.
3.4)@JsonManagedReference and @JsonBackReference annotations are helps to prevents from data duplication issue.
4)This project explains below using Spring Boot, Restful-web-service and JPA,
- Fetch all data from all 2 tables on One-To-One Mapping.
- Fetch single data from all 2 tables against single given data on One-To-One Mapping.
- Fetch multiple data from all 2 tables against multiple given data on One-To-One Mapping.
- Save or Update single data in all 2 tables against single data from request on One-To-One Mapping.
- Save or Update multiple data in all 2 tables against multiple data from request on One-To-One Mapping.
- Fetch all data from child table on One-To-One Mapping.
- Fetch single data from child table against single data from request on One-To-One Mapping.
- Fetch multiple data from child table against multiple data from request on One-To-One Mapping.
- Save or Update single data to child table against single data from request on One-To-One Mapping.
- Save or Update multiple data to child table against multiple data from request on One-To-One Mapping.
5)Use the below link to download the source code,
Previous session: Click to know - Crud application using Spring Boot - Beginners
Context page: Click here
Home page: Click here
Thanks, I hope you enjoyed this session !!!.
-Somasundar Kanakaraj