开发者

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

开发者 https://www.devze.com 2023-04-01 20:46 出处:网络
My environment: Hibernate 1.0 JPA Netbeans 7.01 Sql server 2005 Part of code: public class EdiAgendamentoCliente implements Serializable {

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

精彩评论

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

关注公众号