I'd like to add a method that finds a Todo item based on a given description. Online people are saying you can use JSQL and that Spring will automatically implement it. I tried the following:
public interface TodoRepo extends CrudRepository<Todo, Long> {
@Query("SELECT t FROM Todo t WHERE t.description=:description")
Todo findByDescription(@Param("description") String description);
}
However, I got an error saying that the symbol "@Query" could not be found. Is there some wiring or importing I'm failing to do? Is there another way to implement a custom method? Thanks!
findByDescription(String description)to have Spring data JPA implement it for you.