🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: JPA and Hibernate: all 10 questions

Quiz: JPA and Hibernate · Question 7 of 10

Inside one transaction, the same course id is loaded twice. How many SELECT queries run?

Inside one transaction, the same course id is loaded twice. How many SELECT queries run?

  1. A.One, because Hibernate's first-level cache returns the already-loaded entity
  2. B.Two
  3. C.None
  4. D.One per field
Answer & explanation

Correct answer: One, because Hibernate's first-level cache returns the already-loaded entity

The persistence context keeps managed entities for the length of the transaction.

Can you get the rest right without peeking?

Take the timed Quiz: JPA and Hibernate quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →