Skip to content

NH-2922 - Non-orphaned rows being deleted with cascade="all-delete-orphan" #1253

Open
@nhibernate-bot

Description

@nhibernate-bot

Phil Degenhardt created an issue — 26th October 2011, 1:38:33:

When a child is removed from a cascade="all-delete-orphan" bag and moved to a new parent (reparenting), NHibernate should throw an ObjectDeletedException with the message "deleted object would be re-saved by cascade (remove deleted object from associations)". This ensures that transactions will fail where users assume they can reparent such objects.

However, this exception is not thrown if the new parent object was loaded by the session before the current parent. In this case, the child object is deleted from the database and no warnings or exceptions are produced.

This bug has the potential to cause data loss and very difficult to find bugs.


Phil Degenhardt added a comment — 26th October 2011, 1:43:30:

Test case


Stefan Steinegger added a comment — 26th October 2012, 8:20:52:

Agree, but this isn't a blocker in my opinion, because it doesn't block anyone who is using NH correctly.


Phil Degenhardt added a comment — 14th January 2014, 5:47:03:

So what about the failing test case is using NH 'incorrectly'?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions