Note that there are some explanatory texts on larger screens.

plurals
  1. PONhibernate one to many delete not working
    text
    copied!<p>Hi I have a one to many ComplianceSet -> ComplianceItem. ComplianceItem has a one to many ComplianceItem -> ComplianceItemInstance. </p> <p>I have</p> <p>ComplianceSet</p> <p><code>HasMany(x =&gt; x.GetUserComplianceItems()).Inverse().Access.CamelCaseField(Prefix.Underscore).LazyLoad().Cascade.AllDeleteOrphan(); </code></p> <p>And</p> <p>ComplianceItem</p> <p><code>HasMany(x =&gt; x.GetUserComplianceItemInstances()).Inverse().Access.CamelCaseField(Prefix.Underscore).LazyLoad().Cascade.AllDeleteOrphan(); </code></p> <p>Then in my code I have </p> <p><code>userComplianceSet.GetUserComplianceItems().FirstOrDefault(....); ... userComplianceItem.RemoveUserComplianceItemInstance(userComplianceItemInstance);</code></p> <p>this code returns </p> <p>deleted object would be re-saved by cascade (remove deleted object from associations)[DecisionCritical.Core.Domain.UserComplianceSet#12]</p> <p>Now this is very frustrating. If I remove the cascade from both collections the code returns success but the db show's that it didn't do anything. the ComplianceItemInstance.ComplianceItemId field is still populated and of course the item is still there. In anycase, I just want to be able to delete a child from a collection, call save on the object holding the collection and have the freakin thing go away. I've tried all manner of permutations of cascade, save ( saving the set, saving the item ) adding delete to the ComplianceItemInstance and so and can't get this to work. </p> <p>Please help</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload