JPA vs Hibernate — Concept Check
Questions on JPA vs Hibernate. JPA is the Java specification (API + annotations); Hibernate is the most popular implementation. You code against JPA interfaces for portability but benefit from Hibernate-specific features.
Questions in this quiz
8 questions on JPA vs Hibernate — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer wants to use caching by natural key in their application. Which annotation should they use?
- A@Entity
- B@Table
- C@NaturalId
- D@OneToMany
2.Your project needs to perform batch loading for a collection. Which Hibernate-specific feature would you use?
- A@BatchSize
- B@Filter
- C@Entity
- D@Cache
3.A team uses Spring Data JPA for CRUD operations. Which layer does Spring Data JPA sit on top of?
- AJPA
- BJDBC
- CDatabase
- DHibernate
4.A developer uses @Entity, @Table, and @OneToMany annotations. Which specification are they coding against?
- AHibernate
- BJPA
- CJDBC
- DSpring Data JPA
5.Your application requires soft deletes. Which feature should you consider using?
- A@OneToMany
- B@Entity
- C@Table
- D@Filter
6.A developer claims that using Hibernate-specific features like @NaturalId ensures portability across all JPA providers. Is this true?
- AYes, all JPA providers support Hibernate features
- BYes, Hibernate features are part of JPA
- CNo, Hibernate features are deprecated
- DNo, Hibernate-specific features tie the project to Hibernate
7.A developer wants to write custom queries using method names. Which feature of Spring Data JPA allows this?
- A@Query annotation
- BQuery derivation
- CJPQL
- DCriteria API
8.Your application needs to perform bulk processing without dirty checking. Which Hibernate feature would you use?
- AEntityManager
- BStatelessSession
- C@NaturalId
- D@BatchSize