nhibernate-core
nhibernate-core copied to clipboard
NH-2515 - Enable on-delete="cascade" for <element> and <composite-element>
Mattias Öhrn created an issue — :
Currently it is not possible to add the on-delete="cascade" attribute to the
<key>element of a collection mapping with<element>or<composite-element>. Doing so leads to an exception with the message 'only inverse one-to-many associations may useon-delete="cascade: <entity type>"'.One reason to enable this is that currently HQL deletes against an entity with an element (or composite element) collection will fail due to a foreign key constraint violation assuming that the collection is non-empty and that the database schema has been created with the hbm2ddl tool.
Another reason might be that
ISession.Deletecould be more efficient in this case by relying on the database for deleting the collection items.
Mattias Öhrn added a comment — :
Sorry about the ugly title and description - I thought I had to use entity encoding for special characters and now I can't find a way to change it. So if a nice admin sees this, please clean it up.
I'm not the one to 'bump' issues, but I'd really really really love it you could look at this one, please.
hibernate commit that removes exception https://github.com/hibernate/hibernate-orm/commit/7c2a58861341f1404b4974f1ed9809f40c1da8f6 (though not sure if it really fixes reported issue)