Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateOnlyTypeHandler should return java.util.Date #3334

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}

}
Loading