在JPA的@Query注解中使用limit条件(详解)-创新互联
在@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 List getBaselineOverview()
{
return misakaService.getMisaka();
}
} 网站栏目:在JPA的@Query注解中使用limit条件(详解)-创新互联
标题链接:http://www.jxjierui.cn/article/dseesh.html


咨询
建站咨询
