I'm trying to do a query, using mySql fullText index "match against" syntax with a paegable.
I changed the spring-boot version from 1.5.4.RELEASE to 2.0.0m7 to use spring-data-jpa version 2.0.2.RELEASE, because in the earlier spring-data-jpa version, a native query with a countQuery wasn't working.
I've fixed a couple of problems, using the solutions here and here.
The current problem is the following error:
javax.servlet.ServletException: org.springframework.orm.jpa.JpaSystemException: could not execute query; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query
...
Caused by: java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).
And here is the code
@Query( value = "SELECT Distinct u.* " +
"FROM user AS u " +
"WHERE MATCH(u.name, u.email) against(:filterValue) " +
"ORDER BY u.id \n#pageable\n#",
countQuery = "SELECT count(Distinct u.id) " +
"FROM user AS u " +
"WHERE MATCH(u.name, u.email) against(:filterValue) " +
"ORDER BY u.id \n#pageable\n#",
nativeQuery = true)
Page<User> foo(@Param("filterValue") String filterValue, Pageable pageable);
If I try to set pageable as a param too, the same error occurs.
Any thoughts?