Recall & Review
beginner
What is JPA and why is it used in Spring Boot?
JPA (Java Persistence API) is a way to manage data between Java objects and a database. It helps Spring Boot apps save, update, and load data easily without writing complex SQL.
Click to reveal answer
beginner
What does a relationship in JPA represent?
A relationship in JPA shows how two or more data tables connect, like how a person has many addresses. It helps keep data linked and organized.
Click to reveal answer
beginner
Name the three main types of relationships in JPA.
The three main types are: One-to-One (one item linked to one item), One-to-Many (one item linked to many items), and Many-to-Many (many items linked to many items).
Click to reveal answer
intermediate
Why is managing relationships important in JPA?
Managing relationships helps keep data consistent and easy to access. It avoids mistakes like missing linked data or saving wrong info.
Click to reveal answer
intermediate
How does JPA handle saving related data automatically?
JPA uses cascading options to save or delete related data together. For example, deleting a user can also delete their posts if cascade is set.
Click to reveal answer
Which JPA annotation defines a one-to-many relationship?
✗ Incorrect
The @OneToMany annotation is used to define a one-to-many relationship in JPA.
Why are relationships important in JPA?
✗ Incorrect
Relationships link tables and help keep data consistent and easy to manage.
What does cascading in JPA do?
✗ Incorrect
Cascading lets JPA automatically save or delete related data when the main entity changes.
Which relationship type means many items linked to many items?
✗ Incorrect
Many-to-Many means many items on one side link to many items on the other side.
In JPA, what annotation would you use to link two entities with a one-to-one relationship?
✗ Incorrect
The @OneToOne annotation defines a one-to-one relationship between two entities.
Explain why relationships matter in JPA and how they help manage data.
Think about how real-life connections between things help organize information.
You got /4 concepts.
Describe the main types of relationships in JPA and give a simple example for each.
Use examples like person-address, author-books, or students-courses.
You got /3 concepts.