Friday, June 20, 2008

Cannot insert explicit value for identity column in table "Table Name" when IDENTITY_INSERT is set to OFF.

need to Add the following Annotations.
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@NotNull
@Column(name = "EventPhaseID", unique = true, nullable = false)

Also keep the Identity Specification of The primary Key to YES in the MSSQL Database Table properties

No comments: