TypeException: Error setting non null for parameter #1 with JdbcType null

Insert the expiration date into mysql. The error is:

Login exception is org.apache.ibatis . type.TypeException : Could not set parameters for mapping: ParameterMapping{property=’expired’, mode=IN, javaType=class java.util.Date , jdbcType=null, numericScale=null, resultMapId=’null’, jdbcTypeName=’null’, expression=’null’}. Cause: org.apache.ibatis . type.TypeException : Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException : Parameter index out of range (1 > number of parameters, which is 0).

I always thought that the MySQL insert date required format. After traversing various methods, I saw a blog and found that it was a problem with my own insert statement…

@Insert({"insert into ", TABLE_NAME, "(", INSERT_FIELDS,") values (#userId}, #{expired}, #{status}, #{ticket})" })

There is one missing userid{

Right for

@Insert({"insert into ", TABLE_NAME, "(", INSERT_FIELDS,") values (#{userId}, #{expired}, #{status}, #{ticket})" })

Taikeng, record it

Read More: