Dear Reader,
I am getting below error when executing an application. Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
Entity class is shown below.
@Entity @Table(name = "Student") @org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true) public class Student { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "profileKey", nullable = false) private int profileKey;
@Column(name = "UserId", columnDefinition="uniqueidentifier") private String userId; // uniqueidentifier } The is created in ms SQL server 2008.
Table Student( profileKey [INT PK] userId [uniqueidentifier FK])
Please let me know how to resolve the above exception and dynamicInsert , dynamicUpdate . Jars used for this application.
hibernate-commons-annotations-4.0.2.Final.jar hibernate-core-4.2.16.Final.jar hibernate-jpa-2.0-api-1.0.1.Final.jar
Thanks in Advace.
Thanks, Purushotham
|