Spring Data JPA

Test your understanding of repositories,query methods,and entity mapping.

1. Which Spring Data JPA interface provides basic CRUD operations, pagination, and sorting capabilities?
2. What is the default behavior of the save() method in Spring Data JPA when the entity has no identifier (ID) set?
3. Which annotation is used to define a custom JPQL query in a Spring Data JPA repository method?
4. What does the method name 'findByLastNameOrderByFirstNameAsc' derive?
5. Which of the following is NOT a method provided by the CrudRepository interface?
6. What annotation is required to mark a class as a JPA entity managed by Spring Data JPA?
7. What is the return type of the findById(ID id) method in CrudRepository?
8. Which keyword in a repository method name is used to perform a 'not equal' comparison?
9. Which of the following are core repository interfaces provided by Spring Data JPA?
10. How can queries be defined in Spring Data JPA repositories?
11. Which annotations are used to configure primary key generation for JPA entities?
12. Which of the following are valid return types for Spring Data JPA repository methods?
13. What are the key benefits of using Spring Data JPA?
14. Spring Data JPA requires developers to write explicit implementations for repository interfaces.
15. The @Query annotation can be used to define both JPQL and native SQL queries.
16. The deleteById(ID id) method in CrudRepository returns the deleted entity.
17. Spring Data JPA automatically handles transaction management for repository CRUD methods.
18. What attribute of the @Query annotation is used to enable a native SQL query (name only)?
19. Name the Spring Data JPA interface that provides pagination and sorting support (full interface name).
20. What is the default fetch type for @ManyToOne relationships in JPA (EAGER/LAZY)?
Answered 0 of 0 — 0 correct