开发者

Hibernate 1.0 + JPA + Netbeans 7.01 + Sql server 2005 = Problems to insert into table with GenerationType.IDENTITY

My environment:

Hibernate 1.0 JPA Netbeans 7.01 Sql server 2005

Part of code:

public class EdiAgendamentoCliente implements Serializable {
private static final long 开发者_StackOverflowserialVersionUID = 1L;
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id_edi", unique = true, nullable = true)
private Integer idEdi;

Error:

"java.lang.IllegalArgumentException: id to load is required for loading"


Im trying to insert values into a table with auto increment, but its not working, can you guys give me some direction here?


Change it to nullable false, and check column name in database matches the name attribute

@Column(name = "id_edi", unique = true, nullable = false)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜