Hi,
I'm caught between two problems here...
1. In my mapping i have
Code:
<map name="routeDests" inverse="true" cascade="save-update, delete" >
<key column="ROUTE_NO" />
<index column="DEST_STN" type="String" />
<one-to-many class="RTS.RtRouteDest, RTSRailTerminalSystem.Core" />
</map>
This enables me to successfully create a new parent with no children (and not get any errors).
But, as a result of omitting the 'delete-orphan', I am unable to delete a child from a parent using cascading.
So, if I change my mapping to the following:
Code:
<map name="routeDests" inverse="true" cascade="save-update, delete, delete-orphan" >
<key column="ROUTE_NO" />
<index column="DEST_STN" type="String" />
<one-to-many class="RTS.RtRouteDest, RTSRailTerminalSystem.Core" />
</map>
Then I can successfully delete the child from the parent using cascading.
But, then I am unable to create a new parent with no children, because of the following error: 'no collection snapshot for orphan delete' (see the following page for more info on that bug:
http://nhjira.koah.net/browse/NHMA-19).
So, can someone please help me to set up my mapping file up so that i can do BOTH of the above?
These being...
1. create a new parent with no children, and
2. delete a child from a parent using cascading.
Thanks in advance.