JDBC: in set condition: can I pass a set as single param?

前端 未结 3 1262
挽巷
挽巷 2021-01-03 07:58

In JDBC I can use question marks for query parameters, like this:

\"SELECT * FROM users WHERE login = ?\"

and then

ps.setSt         


        
3条回答
  •  情书的邮戳
    2021-01-03 08:25

    Look here for an overview of available options. As far as I can tell you, everyone is dynamically generating the necessary number of placeholder characters (with some optimizations).

    There's a setArray method in PreparedStatement, but sometimes using it is not feasible. You might give it a try though.

    If Spring's JDBCTemplate is an option, you could use automatic collection expansion as described here.

提交回复
热议问题