如何将列表/集合/数组作为参数值传递给Apache QueryRunner? [英] How do I pass a List/Set/Array to Apache QueryRunner as parameter value?

查看:142
本文介绍了如何将列表/集合/数组作为参数值传递给Apache QueryRunner?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以执行以下查询:

Is there any way to perform the following query:

select * from table where field in (?)

并传递列表/集合/数组作为?占位符的值.

and pass a list/set/array as a value for ? placeholder.

我正在使用Apache db-commons库中的QueryRunner.

I'm using QueryRunner from the Apache db-commons library.

推荐答案

当然可以,使用

(示例正在使用PostgreSQL,但也应该适用于其他人)

(example is using PostgreSQL but should also work for others)

这篇关于如何将列表/集合/数组作为参数值传递给Apache QueryRunner?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆