From the course: Java Persistence with JPA and Hibernate
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Inheritance - JPA Tutorial
From the course: Java Persistence with JPA and Hibernate
Inheritance
- [Instructor] Inheritance is a concept that you use in object-oriented modeling where one class can inherit the features and behavior of another class. Essentially, we implement a parent-child relationship between classes. Why do you use inheritance? Well, there might be many reasons or benefits of using it. One of them is code reuse, and another is the ability to use polymorphism. However, in the relational model, there's no way of representing the concept of inheritance and there's no straightforward way to map class hierarchies into database tables. The Jakarta persistence specification provides four strategies for representing inheritance relationships. Mapped superclass, single table, joint table, table per class. Each of these strategies work with four different database structures. In the library, there are members, members can be students or teachers. So a member is a generic type and student and teacher inherit from it. Let's start with mapped superclass strategy. The member…
Contents
-
-
-
-
-
-
-
-
(Locked)
One-to-one relationships8m 13s
-
@OneToMany and @ManyToOne annotations in a relationship8m 8s
-
(Locked)
Many-to-many relationships7m 29s
-
(Locked)
Inheritance9m 40s
-
(Locked)
More inheritance strategies9m 25s
-
(Locked)
Composition relationship11m 6s
-
(Locked)
Challenge: Art Class Management app, part 41m 58s
-
(Locked)
Solution: Art Class Management app, part 44m 41s
-
(Locked)
-
-
-