Re: [h2] H2 PreparedStatement and Arrays

2022-12-06 Thread Helmut Leininger
Thank you very much for this hint. It does the trick. Am 06.12.2022 um 10:55 schrieb Evgenij Ryazanov: Your code actually constructs something like mstb_etypenum IN (ARRAY[2, 3, 4, 5]) instead of mstb_etypenum IN (2, 3, 4, 5). In SQL statements from JDBC (unlike in JPQL from JPA) you cannot pas

Re: [h2] H2 PreparedStatement and Arrays

2022-12-06 Thread Evgenij Ryazanov
Your code actually constructs something like mstb_etypenum IN (ARRAY[2, 3, 4, 5]) instead of mstb_etypenum IN (2, 3, 4, 5). In SQL statements from JDBC (unlike in JPQL from JPA) you cannot pass parameters in that way. One parameter always creates one value. You can use mstb_etypenum = ANY(?) i

Re: [h2] H2 PreparedStatement and Arrays

2022-12-06 Thread Helmut Leininger
Unfortunately, this does not solve my problem. there is no table or column named BIGINT. The error seems to happen within H2 when it should  the Array typeArray as an arry of values to be used in the IN clause. It seems to try to convert the Array to a single BIGINT value for whatever reason (whi

Re: [h2] H2 PreparedStatement and Arrays

2022-12-06 Thread Noel Grandin
You can do something like: final Long[] messageIds = ... final String sqlQuery = "SELECT * FROM FROM FOO WHERE FOO.MessageID IN (SELECT ID FROM TABLE(ID BIGINT=?))"; PreparedStatement ps = conn.prepareStatement(sSqlQuery); ps.setObject(1, messageIds ); -- You received this messa

[h2] H2 PreparedStatement and Arrays

2022-12-05 Thread Helmut Leininger
I am using H2 2.1.214 and facing this problem: part of SQL Select statement: ... + "where events.mstb_recno in (select mstb_recno from events where events.mstb_edate >= ? and events.mstb_edate <= ?) and " + "mstb_etypenum in (?) and " ... this statement can be prepared wit