我使用的是 mybatis-3.1.1,下面的代码没有问题。
DAO 实施
@Override
public ItunesPriorityReportDates getWeeklyPriorityDates(Date reportRunDate){
ItunesPriorityReportDates itunesPriorityReportDates = new ItunesPriorityReportDates();
Map<String,Object> weeklyPriorityDatesParamMap = new HashMap<>();
weeklyPriorityDatesParamMap.put("reportRunDate", reportRunDate);
log.debug("Report Run Date : " + reportRunDate);
this.getItunesAnalysisMapper().getWeeklyPriorityDates(weeklyPriorityDatesParamMap);
itunesPriorityReportDates.setAriaWeekStartDate((Date)weeklyPriorityDatesParamMap.get("ariaWeekStartDate"));
itunesPriorityReportDates.setAriaWeekEndDate((Date)weeklyPriorityDatesParamMap.get("ariaWeekEndDate"));
itunesPriorityReportDates.setitunesAccountPeriodStartDate((Date)weeklyPriorityDatesParamMap.get("itunesAccountPeriodStartDate"));
itunesPriorityReportDates.setitunesAccountPeriodEndDate((Date)weeklyPriorityDatesParamMap.get("itunesAccountPeriodEndDate"));
return itunesPriorityReportDates;
}
映射器
public ItunesPriorityReportDates getWeeklyPriorityDates(Map<String,Object> weeklyPriorityDatesParamMap);
映射器 XML。
<select id="getWeeklyPriorityDates" parameterType="java.util.HashMap" statementType="CALLABLE">
{CALL external_reporting.itunes_sales.get_weekly_priority_dates(#{reportRunDate mode=IN, jdbcType=DATE},
#{ariaWeekStartDate mode=OUT, jdbcType=DATE},
#{ariaWeekEndDate mode=OUT, jdbcType=DATE},
#{itunesAccountPeriodStartDate mode=OUT, jdbcType=DATE},
#{itunesAccountPeriodEndDate mode=OUT, jdbcType=DATE}
)
}
</select>
升级到 mybatis-3.2.5 后,它现在将 null 作为 DATE 传递给 Oracle 过程。
你能帮我解决这个问题吗?不确定我是否必须更新我的映射器 XML 并包含一些东西来告诉它正确解析。
我在 java 中使用 java.util.Date。
谢谢奇拉格