首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

工作札记-“ids for this class must be manually assigned before calling save”解决方法

2012-09-15 
工作札记--“ids for this class must be manually assigned before calling save”解决办法一般是没没有在X

工作札记--“ids for this class must be manually assigned before calling save”解决办法

一般是没没有在XXX.java中对主键设置自增长造成的。

加入以下代码即可:

@GeneratedValue(strategy=GenerationType.AUTO)


如:

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}

热点排行