jpa sql查询的问题

丶Palette 2019-06-19 04:56:52
@Query(value = "select * from t_sub_forum s where id in (select f.sub_forum_id from t_sub_forum_user f where f.user_id = id ) and s.record_status= 0 and s.theme like '%theme%';",nativeQuery = true)
Page<SubForumEntity> getListByPage(@Param("theme") String theme,@Param("id") long id,
Pageable pageRequest);

报错:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by s.timeStart desc limit 50' at line 1

但是我在navicat查询这个语句的时候 就能执行成功
...全文
71 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
人生没有等式 2019-06-19
  • 打赏
  • 举报
回复
s.theme like concat('%',?1,'%')

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧