Reputation: 33
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
.
Upvotes: 2
Views: 269
Reputation: 856
maybe
@Query(value = "select * from tbl_user where path like CONCAT('%,',?1,',%')", nativeQuery = true)
Iterable<Tbl_user> findAllChildUsers(int id);
will help
Upvotes: 3
Reputation: 440
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.
Upvotes: 0