MyBatisとpostgresを使ってjavaのwebアプリケーションを作成しています。
下記のように参照クエリを実行するとキャストエラーが発生してしまいます。
■MyBatisのjavaファイル
java
1 List<RaceEntity> getRace(@NotNull @Param("fromDate") Date fromDate, @NotNull @Param("toDate") Date toDate, @Param("distances") List<Integer> distances);
■MyBatisのxmlファイル
xml
1<select id="getRace" resultMap="raceInfo"> 2 select 3 race_id 4 from t_race 5 where host_date between #{fromDate} and #{toDate} 6 and distance in 7 <foreach item="item" index="index" collection="distances" open="(" separator="," close=")"> 8 #{item,javaType=Integer} 9 </foreach> 10 </select>
■postgresで出力されるエラー
postgreSQL
1ERROR: operator does not exist: integer = character varying at character 541 2HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
■javaのコンソール例外
java
1### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying 2 ヒント: No operator matches the given name and argument type(s). You might need to add explicit type casts. 3 ポジション: 541 4### The error may exist in jp/keiba/analitics/mapper/simulation/SimulationMapper.xml 5### The error may involve defaultParameterMap 6### The error occurred while setting parameters
解決方法がわからず困っております。
お手数をおかけしますがお力添えをいただけると大変幸いです。
よろしくお願いいたします。
回答3件
あなたの回答
tips
プレビュー