@Repository
public interface StudentRepository extends CrudRepository<Student, String>, CustomRepository<Student> {
}
@Repository
public interface EmployeeRepository extends CrudRepository<Employee,String> ,CustomRepository<Employee> {
}
@NoRepositoryBean
public interface CustomRepository<T> {
List<Object> customFindAll(Map<String, Object> map);}
public abstract class CustomRepositoryImpl<E, T> implements CustomRepository<T> {
private JdbcTemplate jdbcTemplate;
@Autowired
CustomRepositoryImpl(JdbcTemplate jdbcTemplate){
this.jdbcTemplate = jdbcTemplate;
}
@Override
public List<Object> customFindAll(Map<String, Object> params) {
//dynamic query goes here
return List<Object>
}
Getting Exception;
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract java.util.List EE.custom.repo.CustomRepository.customFindAll(java.util.Map); Reason: No property 'customFindAll' found for type 'Employee'; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property 'customFindAll' found for type 'Employee'
It is trying to find customFindAll
as a property in my Employee
dao but it's a custom method name not a property.
Any help , how to handle Generic CustomRepository with Custom methods for dynamic Queries in spring data jdbc.
Referred