Based on Brian McCallisters' original blog post: http://skife.org/jdbi/java/2011/12/21/jdbi_in_clauses.html
@UseStringTemplate3StatementLocator("/sql/templates/TestDao.sql.stg") public interface TestDao { @SqlQuery IteratorgetDevicesWithInClause( @BindIn("guids") List guids, @Bind("limit") Integer limit); }
The main pieces of information that I had to hunt around for are:
- @UseStringTemplate3StatementLocator replaces the now deprecated
@ExternalizedSqlViaStringTemplate3 - you can pass a value to the @UseStringTemplate3StatementLocator which is the location (on the classpath) of the string template file.
- In your string template file, for normal @Bind parameters you still use the standard colonprefix
sql/templates/TestDao.sql.stg
group TestDao;
getDevicesWithInClause(guids, limit) ::= << select distinct(guid) from table where guid in () limit :limit >>