代码语言:javascript复制
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111
; uncategorized SQLException for SQL []; SQL state [99999]; error code [17004]; 无效的列类型: 1111; nested exception is java.sql.SQLException: 无效的列类型: 1111
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
MyBatis 插入空值时,需要指定JdbcType
代码语言:javascript复制public interface MyAttachmentDao {
@Insert("insert into attachments(objId,name,fileType,updateTimestamp,superName) values(#{objId,jdbcType=INT},#{name,jdbcType=VARCHAR},#{fileType,jdbcType=CHAR},#{updateTimestamp,jdbcType=TIMESTAMP},#{superName,jdbcType=VARCHAR})")
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(MyAttachmentBean a);
}