[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1594) Add on-delete="cascade" support to unidirectional *ToOne relationships.

Ivan Garcia (JIRA) noreply at atlassian.com
Tue Feb 5 04:30:55 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29447 ] 

Ivan Garcia commented on HHH-1594:
----------------------------------

Hi, I think this feauture it's very important. You can have unidirectional *ToOne relationships wiht on-delete and on-update policcies support. You can add another attribute like on-update, for example you can have:

<class name="Parent">
  ....
</class>

<class name="Child">
 ...
  <many-to-one name="parent" on-delete="cascade" on-update="cascade"/>
</class>

The cascade possible values can be:

No Action
Cascade
Set Null
Restrict

With the current version of HB we must to have a .sql script to modify this relationships on delete and on update policies. 

> Add on-delete="cascade" support to unidirectional *ToOne relationships.
> -----------------------------------------------------------------------
>
>                 Key: HHH-1594
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1594
>             Project: Hibernate3
>          Issue Type: Improvement
>          Components: core
>         Environment: Hibernate 3.1.x, any dialect with cascading deletes.
>            Reporter: Steve Bazyl
>
> Currently the on-delete="cascade" option is only available on bi-directional/inverse collections.  However, there are some instances where we don't want the collections on the parent side of the relationship, creating a unidirection relationship from child to parent.  It would be nice to be able to do something like:
> <class name="Parent">
>   ....
> </class>
> <class name="Child">
>  ...
>   <many-to-one name="parent" on-delete="cascade"/>
> </class>
> So that child entries are deleted when the parent goes away.  Obviously in this particular example it would be OK to add the collection, but in the actual situation we'd like this in the collection would serve no practical purpose.
> It's not critical by any means -- we can just tewak the schema by hand and that's fine.  But it seems like an easy enough thing to add and would make the schema generation/update tools a little more robust.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list