-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to execute MySql Insert query if table has no unique key
PostPosted: Thu May 15, 2008 6:11 am 
Newbie

Joined: Thu May 15, 2008 6:03 am
Posts: 3
Hi,
I have one table in mysql with 2 fields named typeid and privilegeid , now there is no unique or primary key in the table ,but xml configuration file needs primary key to be defined in in within <id> tag ,but my table has no primary key,iam realy stuck at that point, i used createSqlQuery method it does't work, i searched a lot but nothing helped,if anybody please tell me how can i insert data into my table which dont have primary key,he/she will be most appriciated :)

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 7:58 am 
Regular
Regular

Joined: Thu Mar 06, 2008 5:06 am
Posts: 68
Can you set typeid and privilegeid as composite id in your hibernate mapping? I think it should work...


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 8:20 am 
Newbie

Joined: Thu May 15, 2008 6:03 am
Posts: 3
I did that too, can you please tell me only that how can i insert data into table which have two fields and no field is primary key,how can i??? please suggest me .

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 10:19 am 
Regular
Regular

Joined: Thu Mar 06, 2008 5:06 am
Posts: 68
You can't, hibernate needs a primary key to handle the mapping.

Do you get exceptions if you take both fields as a composite id?


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

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.