What triggered the detection of "no search property for type" spring data jpa error

error No real estate was found for type com.gridsearch.entities.Film

my repository

package com.gridsearch.repository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import com.gridsearch.entities.Film; public interface FilmRepository extends CrudRepository<Film,Short>{ public Page<Film> findAll(Pageable page); public Film findOne(short Id); } 

my service

 package com.gridsearch.service; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import com.gridsearch.entities.Film; public interface FilmService { public Page<Film> allFilms(Pageable page); public Film findOne(int Id); } 

my service implementation

 package com.gridsearch.service; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.gridsearch.entities.Film; import com.gridsearch.repository.FilmRepository; @Repository public class FilmServiceImpl implements FilmService{ @Autowired private FilmRepository repository; @Transactional public Page<Film> allFilms(Pageable page) { return repository.findAll(page); } @Override public Film findOne(int id) { return repository.findOne((short) id); } } 
+7
source share
2 answers

It should be Short instead of Short :

 public Film findOne(Short Id); 

By the way, you can simply extend the PagingAndSortingRepository , which the findAll(Pageable page) method already provides:

 public interface FilmRepository extends PagingAndSortingRepository<Film,Short>{ } 
+7
source

I know that the question was answered, but I have the same problem, because I left the old method in my repository, for example

 public List<Entity> findByDateBetween(Long a, Long b) 

while the date column no longer exists in my database.

+2
source

All Articles