MyBatis Insert Date Type field in storage, actual date data format is different
Entity properties to be in storage:
Java.util.Date
Private Date Mxreqtime;
Note: The entity attribute of the mxreqtime contains "date, hour and minute" information, and "hour minutes seconds" information is not "00:00:00"
This assumes: mxreqtime=2015-3-9 20:31:34
Sqlmap notation:
<insert id= "Insertxxxorder" parametertype= "Xxorder" >
INSERT INTO Xxxorder (
。。。 ,
Mx_req_time,
。。。
)
Values
#{orderid, Jdbctype=varchar},
。。。 ,
#{mxreqtime, Jdbctype=date},
。。。 ,
)
</insert>
The above writing mx_req_time the results of the form such as : 2015-3-9, that is, "hour minute seconds Information" "00:00:00", do not meet the requirements
SQL Execution log:
Parameters: ... ,2015-03-09 (Date)
After adjustment sqlmap writing:
<insert id= "Insertxxxorder" parametertype= "Xxorder" >
INSERT INTO Xxxorder (
。。。 ,
Mx_req_time,
。。。
)
Values
#{orderid, Jdbctype=varchar},
。。。 ,
#{mxreqtime},
。。。 ,
)
</insert>
Sqlmap adjustment: Mx_req_time storage results shape such as : "2015-3-9 20:31:34", this time contains the normal "hour minute seconds information, fully meet the requirements!"
SQL Execution log:
Parameters: ... , 2015-3-9 20:31:34 (Timestamp)
MyBatis Insert Date Type field in storage, actual date data format is different