I have Country and State objects. I intend to have unidirectional many to one relationship from State to Country. I don't want to store any references to States in Country I have defined mapping as below. When I delete even one State object, all Countries are deleted!
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="places.Country"
table="COUNTRY"
dynamic-update="true">
<!-- Technical ID -->
<id name="name" type="string" unsaved-value="new" column="COUNTRY_NAME">
</id>
<!-- Properties -->
<property name="commonName"
column="COMMON_NAME"
/>
<property name="iso2Code"
column="ISO2_CODE"
/>
<property name="iso3Code"
column="ISO3_CODE"
/>
<property name="isoNumeric"
column="ISO_NUMERIC"
/>
<property name="ituCode"
column="ITU_CODE"
/>
<property name="ianaCode"
column="IANA_CODE"
/>
</class>
<class
name="places.State"
table="STATE"
dynamic-update="true">
<!-- Technical ID -->
<id name="name" type="string" unsaved-value="new" column="STATE_NAME">
</id>
<!-- Properties -->
<property name="code" column="STATE_CODE"
/>
<many-to-one name="country" column="COUNTRY" not-null="true" cascade="none"
class="places.Country"
/>
</class>
</hibernate-mapping>