How to do in-query in jDBI?

后端 未结 4 626
轮回少年
轮回少年 2020-12-05 17:11

How can I execute somethings like this in jDBI ?

@SqlQuery(\"select id from foo where name in \")
List getIds(@Bind(         


        
4条回答
  •  旧巷少年郎
    2020-12-05 18:11

    Use @Define annotation to build dynamic queries in jDBI. Example:

    @SqlUpdate("insert into  (id, name) values (:id, :name)")
    public void insert(@Define("table") String table, @BindBean Something s);
    
    @SqlQuery("select id, name from 
    where id = :id") public Something findById(@Define("table") String table, @Bind("id") Long id);

    提交回复
    热议问题