日期:2014-05-16  浏览次数:20470 次

工作札记--“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;
}