Hi everyone,
I am using JDBI when quering my H2 database,
and I am trying to run a query that looks up records filtered by a list of
statuses (for example: 'OPEN', 'CLOSE'...)
@RegisterMapper(MyDocsMapper.class)
@SqlQuery( "select " +
" * " +
"from " +
" my_table " +
"where " +
" status in (:statusList)")
public abstract List<MyDocs> fetchByStatusList(@Bind("statusList") String[]
statusList);
Running the above only works if the input statusList contains only one
status (list length equals 1).
When I provide a list of many statuses, it does not work !?!
On the other hand, If I hard code the SQL as follows, then the query works:
@RegisterMapper(MyDocsMapper.class)
@SqlQuery( "select " +
" * " +
"from " +
" my_table " +
"where " +
" status in ('OPEN','CLOSE')")
public abstract List<MyDocs> fetchByStatusList(@Bind("statusList") String[]
statusList);
What am I doing wrong?
Do I need to @Bind the String[] in a different way?
Thanks,
Amit
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.