Skip to content

Commit

Permalink
Merge pull request #3334 from JoshKloster/fixDateOnlyTypeHandlerRetur…
Browse files Browse the repository at this point in the history
…nType

DateOnlyTypeHandler should return java.util.Date
  • Loading branch information
harawata authored Dec 27, 2024
2 parents f7e6d98 + 6a1d9b8 commit 64a2736
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/apache/ibatis/type/DateOnlyTypeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ public void setNonNullParameter(PreparedStatement ps, int i, Date parameter, Jdb

@Override
public Date getNullableResult(ResultSet rs, String columnName) throws SQLException {
return toSqlDate(rs.getDate(columnName));
return toDate(rs.getDate(columnName));
}

@Override
public Date getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
return toSqlDate(rs.getDate(columnIndex));
return toDate(rs.getDate(columnIndex));
}

@Override
public Date getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
return toSqlDate(cs.getDate(columnIndex));
return toDate(cs.getDate(columnIndex));
}

private java.sql.Date toSqlDate(Date date) {
return date == null ? null : new java.sql.Date(date.getTime());
private Date toDate(java.sql.Date date) {
return date == null ? null : new Date(date.getTime());
}

}

0 comments on commit 64a2736

Please sign in to comment.