🎙 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 10 of 10

Why does a JPA entity need a no-argument constructor?

Why does a JPA entity need a no-argument constructor?

  1. A.For JSON conversion only
  2. B.So the id can be set by hand
  3. C.Hibernate creates entity objects itself when loading rows, then fills in the fields
  4. D.It is not needed in Spring Boot 4
Answer & explanation

Correct answer: Hibernate creates entity objects itself when loading rows, then fills in the fields

The constructor may be protected so your own code still uses the meaningful one.

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 →