-->
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: foreign key relationship
PostPosted: Tue Aug 30, 2005 8:56 pm 
Regular
Regular

Joined: Fri Mar 04, 2005 1:33 pm
Posts: 65
Location: U.K.
Hibernate version:
2.1

Hi All,

I have 2 tables A and B with primary keys A_id and B_id. Table B has 'not null' A_id column with foreign key constraint. A can han have many B's.

In A.java B is represented as a Set. If I deep fetch A object and delete some of the elements of set B and do
session.saveOrUpdate(A);
In this case, will the rows in table B get deleted as A_id is not null column defined in table B ?

Thanks
Ron


Top
 Profile  
 
 Post subject: yes
PostPosted: Wed Aug 31, 2005 2:35 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Yes, they will be deleted (provided that cascade attribute has appropriate value like 'all')
http://www.hibernate.org/hib_docs/v3/re ... persistent

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.