私はIPアドレス(inetデータ型)を格納するテーブルをpostgresに持っています。私は、次のようにそれを照会しています - コード片の上Spring JDBCTemplateでSQLキャストを提供するには?
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
Map<String, Object> params = new HashedMap();
Collection<Object> ipList = new LinkedList<>();
ips.add("1.2.3.4");
ips.add("5.6.7.8");
namedParameterJdbcTemplate.query("select * from myTable source_ip in (:ipList)",
params, new RowMapper<Object>() {
@Nullable @Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
System.out.println(rs.toString());
return null;
}
});
は私がDBは、私はNamedParameterJdbcTemplate.class
ソースコードに見て、パラメータのデータ型を指定する方法を発見したNo operator matches the given name and argument type(s). You might need to add explicit type casts.
をexception-与えます。
アイデア?