SQLSyntaxErrorException for executing native SQL IN clause query in Spring boot JPA

137 Views Asked by At

I am using MySql Database. I like to write a native query on 'tbl_users'. I wrote the query like below:

@Query(nativeQuery = true, value = "SELECT * FROM tbl_users AS u WHERE u.id IN (:ids)")
List<User> findByUserIdIn(@Param("ids") Set<Long> ids);

But my spring application thrown an exception like

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')'

What will be the right query or how can I overcome this problem. Pls help.

0

There are 0 best solutions below