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 without errors. To supply the values for 
mstb_etypenum I have:
ArrayList<Integer> types ...

    java.sql.Array typeArray = 
pstmtGetEventsByCityMultipleTypes.getConnection()
                    .createArrayOf("INT", types.toArray());
     pstmtGetEventsByCityMultipleTypes.setArray(4, typeArray);
...

Executing this query leads to the following error:
org.h2.jdbc.JdbcSQLDataException: Datenumwandlungsfehler beim Umwandeln von 
"ARRAY to BIGINT"
Data conversion error converting "ARRAY to BIGINT"; SQL statement:
select distinct on (events.mstb_recno) events.*, tagtypes.mstb_etypenum as 
tt_etypenum, tagtypes.mstb_etypename as tt_etypename, 
tagtypes.mstb_properties as tt_properties, tagtypes.mstb_tsentence as 
tt_sentence, tagtypes.mstb_prinrole as tt_principalrole, 
tagtypes.mstb_witrole as tt_witnessrole, tagtypes.mstb_witdisp as 
tt_witnessdisp, tagtypes.mstb_gedcom_tag as tt_gedcomtag, 
tagtypes.mstb_etypenum as tt_etypenum, tagtypes.mstb_tsentence as 
tt_tsentence, witnesses.mstb_primary as wt_primary, witnesses.mstb_role as 
wt_role, witnesses.mstb_eper as wt_eper from events inner join placedict on 
placepv.mstb_uid = placedict.mstb_uid and placepv.mstb_type = ? inner join 
placepv on events.mstb_placenum = placepv.mstb_recno inner join tagtypes on 
events.mstb_etype = tagtypes.mstb_etypenum inner join witnesses on 
events.mstb_recno = witnesses.mstb_gnum where events.mstb_recno in (select 
mstb_recno from events where events.mstb_edate >= ? and events.mstb_edate 
<= ?) and mstb_etypenum in (?) and placedict.mstb_value = ? order by 
events.mstb_srtdate [22018-214]

Question:
Does H2 support arrays with PreparedStatement ? If yes, what is the correct 
handling?

Note:
excuting the basic SQL with 
...
where mstb_etypenum in (2,3,4,5)
...
runs ok.

Thanks and regards


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/5292e1e4-361a-43b2-81ae-5ccf6e4e4c3an%40googlegroups.com.

Reply via email to