-->
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: Any one has a workaround for not-found issue?
PostPosted: Sat Feb 18, 2006 1:24 pm 
Newbie

Joined: Sat Feb 18, 2006 1:15 pm
Posts: 3
Does any one have a workaround for foreign key not-found issue? The broken foreign key always breaks my object tree retireval. I know I can fix the database, but I don't want that my program come to halt whenever some one did some thing wrong to break the data integrity. I just want to be able to handle this kind exception in the code.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 19, 2006 5:41 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
IMHO the best way to prevent this error is to force the data integrity at the database level (using foreign key constraints) - every modern db engine allows to do this. After I've implemented such a policy in my company ( always to use the fk constraints) , I've never seen this error again.

_________________
michal


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 19, 2006 6:40 am 
Contributor
Contributor

Joined: Sun Jun 26, 2005 5:03 am
Posts: 51
Location: London, UK
I'd agree, just because you are using NHibernate for persistence, it doesn't mean you can ignore basic database design principles like not allowing "broken" data in there in the first place.

Are there some other applications accessing your database; otherwise you might be missing a "cascade" attribute in some of your mapping files to force the children to be deleted if the parent is deleted.

_________________
Paul Hatcher
NHibernate Team


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.