← 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?
- A.For JSON conversion only
- B.So the id can be set by hand
- C.Hibernate creates entity objects itself when loading rows, then fills in the fields
- 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 →