I have a similar questions with post
Java Date as Parameter for Oracle SELECT query in MyBatis
but that question didn't get answered and i did post there and haven't heard from it. Mine is quite similar, if i remove the date filter it works perfectly.
myBatis version mybatis-spring-boot-starter v1.3.2 [consider it cant be upgrade]
my mapper xml as below
<mapper namespace="com.wind2.schedulerworker.dw.mapper.ProductBetlineReportMapper">
<resultMap id="productBetlineReportMap" type="ProductBetlineReport">
<id column="REPORT_DRAW_DATE" property="reportDrawDate" jdbcType="DATE" />
<id column="DRAW_DATE" property="drawDate" javaType="java.util.Date" jdbcType="DATE" />
<id column="PBID" property="pbid" jdbcType="VARCHAR" />
<result column="PRODUCT_CHANNEL" property="productChannel" jdbcType="VARCHAR" />
</resultMap>
<select id="selectProductBetlineReportCreated" resultMap="productBetlineReportMap" parameterType="java.util.List">
<foreach item="item" index="index" collection="productBetlineList" separator="union all">
SELECT REPORT_DRAW_DATE, PBID, DRAW_DATE FROM PRODUCT_BET_LINE_REPORT_CREATED
WHERE PBID = #{item.pbid} AND DRAW_DATE = #{item.drawDate}
</foreach>
</select>
</mapper>
my java class as below, i use java.util.Date
import java.util.Date;
public class ProductBetline {
....
private Date drawDate;
....
}
i did quite a few troubleshoot and searched from internet, i did get return result if i change my xml condition to #{item.drawDate} > DRAW_DATE but what i want is "=". i not sure maybe its also timestamp problem or what, but when i select back the input date i put its the same as the db one. for example, 24-JUL-19 00:00:00(from oracle db) and 2019-07-24 00:00:00(from java input). I not sure is the revert of the of the year and date cause problem or what (treat date as year or year as date), but it seems not like it, because if it would my statement would not be correct.
Appreaciate anyone can help me. I troubleshoot this for hours now. Thanks in advance.