← All topics
Quiz: Relationships and Transactions: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Listing 50 enrolments runs 1 query for the enrolments and 50 more for their courses. What is this called?
- Q2. By default, @Transactional rolls back when the method throws…
- Q3. A @Transactional method is called from another method in the same class. What happens?
- Q4. Why model Student ↔ Course with an Enrollment entity instead of @ManyToMany?
- Q5. What causes LazyInitializationException?
- Q6. What is the default fetch type of @ManyToOne if you do not set one?
- Q7. What does readOnly = true on @Transactional tell Spring and the database?
- Q8. A service method declares throws IOException and throws one. With a plain @Transactional, what happens?
- Q9. Two requests both see "1 seat left" at the same moment. Which is a real fix?
- Q10. Why does the Enrollment table also have a unique constraint on (student, course)?