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,