How can you create a custom query method in a Spring Data JPA repository?
- By defining a method with a specific naming convention.
- By using a native SQL query.
- By annotating a method with @Query and providing the JPQL query.
- By creating a new repository interface for custom queries.
In Spring Data JPA, you can create custom query methods by defining a method in your repository interface with a specific naming convention. Spring Data JPA generates the query based on the method name, eliminating the need to write explicit queries. The other options represent alternative ways to create custom queries but are not the typical approach in Spring Data JPA.
Loading...
Related Quiz
- You are developing a Spring Boot application which utilizes reactive programming to handle real-time data. How would you design the application to handle high volumes of concurrent requests efficiently?
- In Spring Security, which interface is primarily used to load user-specific data?
- You are tasked with implementing auditing features in a Spring Data JPA application. How would you implement auditing to track changes in the entities?
- Which file format is generally used in Spring Boot for configuring application properties?
- Which of the following is a common practice for defining custom exception response structures in Spring Boot?