How can I execute somethings like this in jDBI ?
@SqlQuery(\"select id from foo where name in \")
List getIds(@Bind(
This should work:
@SqlQuery("select id from foo where name in ()")
List getIds(@BindIn("nameList") List nameList);
Don't forget to annotate class containing this method with:
@UseStringTemplate3StatementLocator
annotation (beacuse under the hood JDBI uses Apache StringTemplate to do such substitutions). Also note that with this annotation, you cannot use '<' character in your SQL queries without escaping (beacause it is a special symbol used by StringTemplate).