使用updatebyprimarykey()的执行sql没有找到对应的主键。
getMapper().updateByPrimaryKey(entity);
使用日志打印具体的sql如下:但其实只需要根据id更新。
update theme
set id = ?, theme_nm = ?, theme_desc = ?, table_nm = ?,
where id = ? and theme_nm = ? and theme_desc = ? and table_nm = ?
具体解决:
在对应的实体类中加上注解:id=ture
public class entity {
@Entity.Column(insertable = false, id = true)
private Long id;
@Entity.Column("theme_nm")
private String themeNm;
@Entity.Column("theme_desc")
private String themeDesc;
@Entity.Column("table_nm")
private String tableNm;
}