Skip to main content

Mapping - Real-World Scenarios

Learn Mapping - Real-World Scenarios (Spring Data JPA, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Scenario 1 - One User Has Many Policies and Many Nominees Two one-to-many relationships hanging off the same parent. This is where the individual mappings start combining into something that looks like a real application. Business requirement: save one user's details with multiple policies and multiple nominees. Problem statement: design the REST API to save one user with multiple policies and multiple nominees. Table structure Both children carry user_id . The user carries neither - it holds two collections instead.

More lessons in Spring Data JPA