You can do a one-param reusable query via a temporary table, see [1]: new SqlFieldsQuery( "select * from Person p join table(id bigint = ?) i on p.id = i.id").setArgs(new Object[]{ new Integer[] {2, 3, 4} }))
[1] https://apacheignite.readme.io/docs/sql-performance-and-debugging#sql-performance-and-usability-considerations On Sun, Apr 30, 2017 at 11:25 AM, Matt <dromitl...@gmail.com> wrote: > Just a clarification, the code should have said "*query.setArgs(new > Object[]{params})*" but that is NOT the problem, I just pasted the wrong > version in here. > > Also, in case this is not supported by Ignite/H2, a better idea would be > to use "*WHERE foo IN (?, ?, ?, ...)*" and then "*query.setArgs(params)"* > (without wrapping it), but I'm looking for a one-param query, which is > reusable. > > Matt > > On Sun, Apr 30, 2017 at 4:54 AM, Matt <dromitl...@gmail.com> wrote: > >> Hello, >> >> I'm trying to run a SQL standard query with a "WHERE foo = ANY(?)" but it >> seems it's not supported by Ignite. >> >> The code looks like this, it's fairly simple: >> >> --- >> >> >> >> >> >> >> *String sql = "SELECT * FROM Foo WHERE foo = ANY(?)";String[] params = >> {"aaa", "bbb"};SqlQuery<String, Foo> query = new SqlQuery<>(Foo.class, >> sql);query.setArgs(params);cache.query(query);* >> --- >> >> The error is "*IgniteSQLException: Failed to parse query*" and >> "*JdbcSQLException: >> Syntax error in SQL statement*" and it's caused by the "ANY(?)". I also >> tried writing the query without the params, hardcoding the values directly >> on the sql variable, but I'm getting the same result. >> >> Is this kind of query supported? Any workaround to load a list of objects >> dynamically (from an array) without writing multiple "foo = ? OR foo = ? OR >> ..." on the query? >> >> Best, >> Matt >> > >