I have a select statement inside MySQL.
select * from tbl_user where path like '%,id,%'
How can I convert it to a query in Java? What I want to pass id.
I have a select statement inside MySQL.
select * from tbl_user where path like '%,id,%'
How can I convert it to a query in Java? What I want to pass id.
maybe
@Query(value = "select * from tbl_user where path like CONCAT('%,',?1,',%')", nativeQuery = true)
Iterable<Tbl_user> findAllChildUsers(int id);
will help
It depends of what framework/library are you using. in hibernate you can use :id, but you have to also check that it is native query.
In some libraries you just pass a String as a query.