I need a custom Query in my Repository which extends CrudRepository
@Repository
public interface SongListRepository extends CrudRepository<SongList, Integer> {
@Query("SELECT sl FROM song_list sl WHERE sl.owner=:owner")
Set<SongList> findAllSongListsForUser(
@Param("owner") String owner);
}
When I try to start the following excpetion is thrown:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'songListController': Unsatisfied dependency expressed through field 'songListService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'songListService': Unsatisfied dependency expressed through field 'repository';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'songListRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.Set htwb.ai.songsservice.repository.SongListRepository.findAllSongListsForUser(java.lang.String)!
How do i create custom Querys in a CrudRepository?