Mybatis报错“Field ‘id‘ doesn‘t have a default value”

明明已经配置了selectKey,还是报错,找了下,因为表里的id没有设置为自增。。

   @Insert({"insert into song(name,singer,category,writer,language,issudate)values(#{name},#{singer},#{category},#{writer},#{language},#{issudate})"
    })
    @SelectKey(statement = "select last_insert_id()",before = false, resultType = Integer.class,keyProperty = "id")
    public int insert(Songs songs);
}

猜你喜欢

转载自blog.csdn.net/qq_36792120/article/details/112550983