-->
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.  [ 2 posts ] 
Author Message
 Post subject: Ways to Handle Referential Integrity ?
PostPosted: Tue Jun 22, 2004 4:24 am 
Newbie

Joined: Tue Jun 22, 2004 3:45 am
Posts: 3
Hey I am newbie to Hibernate and I have the below issue.

What is the best way in Handling Referential Integrity ?

Actullay I have a code table which has entries different code types like state , country etcc.. Like id , code_type , value , description

I am using this general code as a property in many tables. In few places i have set many-to-one relationship . But in many places like country and state that doesnt make sense . So I am using this as normal property.

Also I have used foreign key relationship .

Now the problem comes at the time of deletion of a used code. Currenlty I am doing a delete and calling flush explicity . If any exception comes (ie JDBCException due to foreign key violation , I say that the code may be in use .

1 , Is this approach correct ??

2 , Any better appraoches??

3 , I want to know under what scenorias this may fail ?

Thanks and Regards
Vijay


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 4:40 am 
Beginner
Beginner

Joined: Mon Jun 21, 2004 7:59 pm
Posts: 21
Maybe an example would help. Also make sure you're not cascading your deletes into your lookup table. That will definitely cause problems with FK relations (and is probably a bug in your map/code).

-Jim


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