-->
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.  [ 3 posts ] 
Author Message
 Post subject: Update Primary Key and Foreign key
PostPosted: Fri Nov 02, 2007 3:54 pm 
Newbie

Joined: Fri Nov 02, 2007 1:45 pm
Posts: 2
How would I change a primary key and have it update the foreign key?
Is this possible with out doign the following multi step operation?
1) Add the new primary key row
2) Update the foreign key with the new foreign key
3) Delete the old primary key row


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 02, 2007 4:00 pm 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
nope. The primary key is what defines a record.
If you change it you now have for the database a different record.
Most databases in fact won't allow you to change the primary key of a record for that very reason, it makes no sense and would easily lead to database corruption.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 02, 2007 4:14 pm 
Newbie

Joined: Fri Nov 02, 2007 1:45 pm
Posts: 2
Thanks for the quick response


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.