From the course: Java Persistence with JPA
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Demo: Utilizing inheritance mapping strategies - Java Tutorial
From the course: Java Persistence with JPA
Demo: Utilizing inheritance mapping strategies
- [Instructor] Let's see these mapping strategies in action. For this example, we'll use the inheritance relationship between the employee, active employee, and retired employee to demonstrate the three main strategies. In the single table strategy, and if you notice here, I've navigated to the employee class on line 11, we are using the single table strategy. All the classes in the hierarchy are mapped to a single table. Let's run this code, and we'll take a look at it. So here we have employee, we have active employee, which extends employee. We also have retired employee, which also extends employee. In the base class, we are using single table. The code ran successfully. Let's see how this single table strategy is modeled in the database. Let's navigate to PG Admin, and let's select all from employees. Notice all of the attributes are defined in this single table. What are some of the pros and cons of the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
What are entity relationships?3m 34s
-
(Locked)
Annotating a one-to-one relationship2m 18s
-
(Locked)
Demo: Annotating a one-to-one relationship2m 24s
-
(Locked)
Annotating a one-to-many relationship2m 34s
-
(Locked)
Demo: Annotating a one-to-many relationship3m 26s
-
(Locked)
Annotating a many-to-one relationship1m 14s
-
(Locked)
Demo: Annotating a many-to-one relationship1m 50s
-
(Locked)
Annotating a many-to-many relationship1m 40s
-
(Locked)
Demo: Annotating a many-to-many relationship3m 11s
-
(Locked)
Utilizing inheritance mapping strategies4m 26s
-
(Locked)
Demo: Utilizing inheritance mapping strategies6m 7s
-
(Locked)
Challenge: Implement a many-to-many relationship53s
-
(Locked)
Solution: Implement a many-to-many relationship2m 30s
-
-
-
-