I use MyBatis3 Dynamic SQL (pure java generated sql without any xml mapper) in spring with mysql as db.
When I have an entity with value of Date type, MyBatis will change the value to timestamp format in generated sql query. For example:
public class Log {
public Date requestTime;
}
I used yyyy-MM-dd HH:mm:dd as date format. The value in mysql db is saved as 2022-09-01 08:08:08. However, mybatis dsl generates query sql with value as 2022-09-01 08:08:08.0. This makes searching result 0 when using where(requestTimeColumn, isEqualTo(requestTime)). The requestTime is the parameter for search as Date type.
btw: The Java Date type is java.util.Date.