在@Query注解注释的JPQL语句中写limit语句是会报错的
unexpected token :limit near line ....
解决方法是讲@Query注解中的limit语句去掉,然后传一个Pageable pageable=new PageRequest(offset,limit)进去
示例代码:
controller
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping(value = "/misaka") public class MisakaController { @Autowired private MisakaService misakaService; @RequestMapping(value = "/list") public ListgetBaselineOverview() { return misakaService.getMisaka(); } }