SSH项目,hibernate配置实体采用注解方式,主键是程序自己生成的,配置如下:
@Id
@Column(name = "serialno", unique = true, nullable = false, length = 15)
public String getSerialno() {
return this.serialno;
}
保存数据时偶尔会报如下错误:
nested exception is org.hibernate.id.IdentifierGenerationException ;
ids for this class must be manually assigned before calling save():
在网上找了一下解决办法,没有解决。
请高手解答一下。