-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: how to define entity class for PK and uniqueidentifier
PostPosted: Mon Dec 15, 2014 11:34 am 
Newbie

Joined: Mon Dec 15, 2014 11:22 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.