I am trying to put some common methods into a "base" interface derived from JpaRepository:
Later in my final repository I extend this interface such as:Code:@Transactional public interface BaseRepository<T extends BaseModel> extends JpaRepository<T, Long> { @Transactional public T findByCode(String code); }
When I run this code, I get an exception:Code:@Repository("brandRepository") @Transactional public interface BrandRepository extends BaseRepository<Brand> { }
I understand that I probably need to provide an implementation for my BaseRepository, however, the findByCode(...) method is a finder that normally is implemented by the JpaRepository architecture, and I am not sure what I should do to make this work.Code:Caused by: java.lang.IllegalArgumentException: You have custom methods in interface com.standardset.spring.repository.BrandRepository but not provided a custom implementation! at org.springframework.data.repository.support.RepositoryFactorySupport.validate(RepositoryFactorySupport.java:216) at org.springframework.data.repository.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:130) at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:107) at org.springframework.data.repository.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:36)
Can someone help me out of this jam?
Thanks.
-AP_


Reply With Quote
