Reputation: 35
The @Query annotation supports only JPA query syntax or Hibernate (HQL)? or both of them i am kinda confused
interface TodoRepository extends CrudRepository<Todo, Long> {
@Async
@Query("SELECT t.title FROM Todo t where t.id = :id")
Book<String> findTitleById(@Param("id") Long id);
Upvotes: 1
Views: 537
Reputation: 4542
SpringData repositories support JPQL (Java Persistence Query Language).
Though JPQL is a subset of HQL so any JPQL query is a valid HQL query. The inverse is obviously not true.
Upvotes: 1