SoFunction
Updated on 2025-04-13

Mybatis3.4.0 does not support LocalDateTime solution (No typehandler found for property time)

Problem description

Error: No typehandler found for property time
(Note: time is a field of type LocalDateTime)

LocalDateTimeTypeHandler

public class LocalDateTimeTypeHandler implements TypeHandler<LocalDateTime> {

    private DateTimeFormatter formatter = ("yyyy-MM-dd HH:mm:ss");

    @Override
    public void setParameter(PreparedStatement ps, int i, LocalDateTime parameter, JdbcType jdbcType) throws SQLException {
        if (parameter != null) {
            (i, (parameter));
        } else {
            (i, null);
        }
    }

    @Override
    public LocalDateTime getResult(ResultSet rs, String columnName) throws SQLException {
        String dateStr = (columnName);
        return dateStr == null ? null : (dateStr, formatter);
    }

    @Override
    public LocalDateTime getResult(ResultSet rs, int columnIndex) throws SQLException {
        String dateStr = (columnIndex);
        return dateStr == null ? null : (dateStr, formatter);
    }

    @Override
    public LocalDateTime getResult(CallableStatement cs, int columnIndex) throws SQLException {
        String dateStr = (columnIndex);
        return dateStr == null ? null : (dateStr, formatter);
    }
}

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-////DTD Config 3.0//EN"
        "/dtd/">
<configuration>
    <settings>

    </settings>
    <typeHandlers>
        <typeHandler handler="" javaType=""/>
    </typeHandlers>
</configuration>

This is all about this article about the solution (No typehandler found for property time) in which mybatis3.4.0 does not support LocalDateTime. For more related content related to mybatis3.4.0 does not support LocalDateTime, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me more in the future!