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.  [ 1 post ] 
Author Message
 Post subject: How to create one-to-one FK that has on delete cascade?
PostPosted: Sat Mar 08, 2008 11:50 am 
Newbie

Joined: Mon Nov 05, 2007 4:44 pm
Posts: 9
I've successfully generated FK that has on delete cascade with

Code:
<class name="Parent">
<id name="id" type="long">
<generator class="native"/>
</id>
<set name="test" inverse="true">
<key column="FID" on-delete="cascade"/>
<one-to-many class="Child"/>
</set>
</class>

<class name="Child">
<id name="id" type="long">
<generator class="native"/>
</id>
<many-to-one name="parent" class="Parent"/>
</class>



but for one-to-one mapping, there doesn't seem to be a key element for me to define on-delete="cascade", which generates the "on delete cascade" when FK relation is generated through hbm2ddl. Is there any example that shows how to configure one-to-one using FK on delete cascade?

More specifically, I'm looking for a mapping that will generate something like
Code:
alter table Child add constraint FK_120392340 foreign key (FID) references Parent on delete cascade


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

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.