我们有以下错误
org.hibernate.id.IdentifierGenerationException:
ids for this class must be manually assigned before calling save():
com.somepage.entity.MyObject
和代码
@Entity
@Table(name = "MYOBJECT")
public class MyObject{
private String myId;
private String title;
@Id
@Column(name = "MYID", unique = true, nullable = false)
public String getId() {
return this.myId;
}
public void setVin(String vin) {
this.vin = vin;
}
@Column(name = "TITLE", length = 10)
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
}
我有一个实体,我在其中输入(在表单中,从网页中)数据到包含ID的对象。是否有必要获得GeneratorValue?如何自己输入我的ID(没有任何不必要的东西)?有什么想法吗?