本文主要是介绍jpa fulltext <expression>, <operator>, GROUP, HAVING or ORDER expected, got ‘(‘,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
直接写sql报错:
jpa fulltext <expression>, <operator>, GROUP, HAVING or ORDER expected, got '('
jpa支持原生SQL和实体类SQL进行自定义查询:
// 原生@Query(value = "SELECT t2.userId, t1.title, t1.content, t1.completeTime, t2.scheduleState" +" FROM schedule t1 LEFT JOIN schedule_user t2 ON t1.id = t2.schedule_id " +" WHERE t2.user_id = ?1 AND t2.schedule_state = ?2", nativeQuery=true)List<ScheduleUserView> findScheduleListByState(Long userId, int scheduleState);// 实体类的
@Query(value = "SELECT new com.x3.schedule.saas.table.ScheduleUserView(" +" t2.userId, t1.title, t1.content, t1.completeTime, t2.scheduleState)" +" FROM ScheduleTable t1 LEFT JOIN ScheduleUserTable t2 ON t1.scheduleId = t2.scheduleId " +" WHERE t2.userId = ?1 AND t2.scheduleState = ?2")List<ScheduleUserView> findScheduleListByState(Long userId, int scheduleState);
我使用的原生sql查询,加了nativeQuery = true
后,不报错了:
大概是这样:
@Query(value = "SELECT p.id, p.xxx FROM product p where MATCH (p.title, p.tags) AGAINST(?1 IN BOOLEAN MODE)", nativeQuery = true)
List<Product> search(String search);
其实查到了很多解决方案,然而我看不懂,只能用最蠢的方法啦
关于use MySQL full text search from JPA,推荐看这篇文章
一个高赞评论,我觉得他写的很好,虽然看不懂:
这篇关于jpa fulltext <expression>, <operator>, GROUP, HAVING or ORDER expected, got ‘(‘的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!