-->
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: Looking for a "ON CHILD DELETE RESTRICT" behaviour
PostPosted: Sat Oct 09, 2004 3:19 pm 
Newbie

Joined: Sat Oct 09, 2004 3:03 pm
Posts: 5
Hi,

I have a -maybe not so 'pure' relational- database requirement on a certain table. That table contains records referred to (FK) by many other tables. When it is being referred to, I want to restrict the deletion of a record in that table.

This is sometime called a "ON CHILD DELETE RESTRICT" constraint.

I read the 'Bauer' book (several times) and search trough the different Hibernate forums, but couldn't find a clue to my problem.

In Hibernate mapping terms, I want to be able to have a property 'name' mapped in different entities like this:
Code:
<many-to-one name="name" not-null="true" unique="true"/>


The referred entity looks like this:
Code:
<hibernate-mapping>
   <class name="bx.ResourceInfo" lazy="true" batch-size="3">
   <id name="name" length="64">
           <generator class="assigned"/>
        </id>
        <version name="version" unsaved-value="negative"/>
        <property name="english" length="65535"/>
        <property name="dutch" length="65535"/>
        <property name="french" length="65535"/>
        <property name="german" length="65535"/>
        <property name="italian" length="65535"/>
        <property name="spanish" length="65535"/>
        </class>
        </hibernate-mapping>


The only workaround I can think of right now is to do a query on all tables (having the FK to ResourceInfo) before doing a delete of a ResourceInfo.

Any ideas how I can solve this more elegantly?

Thanx,


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.