Non-orphaned rows being deleted with cascade="all-delete-orphan"

Description

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.

Environment

None

Attachments

3
  • 26 Oct 2011, 01:43 AM
  • 26 Oct 2011, 01:43 AM
  • 26 Oct 2011, 01:43 AM

Activity

Show:

Phil Degenhardt January 14, 2014 at 5:47 AM

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

Stefan Steinegger October 26, 2012 at 8:20 AM

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

Phil Degenhardt October 26, 2011 at 1:43 AM

Test case

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created October 26, 2011 at 1:38 AM
Updated January 17, 2014 at 4:38 AM
Who's Looking?