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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *