java - Use spring projection with JPA specification -
i trying ot use jpa specification api spring projection find entities matching search criteria. here's class hierarchy :
**a.java** string name; instant timestamp; integer count; ... **aprojection.java** @projection(types = a.class) public interface athumbnail { public integer getcount(); public string getname(); } **arepository.java** public interface arepository extends baserepository<a, integer>, jpaspecificationexecutor<a> { page<athumbnail> findall(specification<a> var1, pageable var2); } **acontroller.java** page<athumbnail> pageda = repository.findall(getspecifiation(wherecriteria), pagingdetail);
now getting compile error saying
findall(org.springframework.data.jpa.domain.specification<a>,org.springframework.data.domain.pageable) in arepository clashes findall(org.springframework.data.jpa.domain.specification<t>,org.springframework.data.domain.pageable) in org.springframework.data.jpa.repository.jpaspecificationexecutor return type org.springframework.data.domain.page<athumbnail> not compatible org.springframework.data.domain.page<a>
my problem want specification of base type a, findall result of type page, , 2 aren't compatible. there solution ? or other better way can ?
Comments
Post a Comment