Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8528977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:55:26+00:00 2026-06-11T08:55:26+00:00

I have an intermittent problem in a production system that I haven’t been able

  • 0

I have an intermittent problem in a production system that I haven’t been able to recreate locally. What appears to be happening is that for no obvious reason during an edit of a child entity and saving the parent containing the collection the parent association on the child entity is removed in the database. Effectively orphaning the child entity.

Here is the fluent mapping:

 mapping.HasMany<ExpenseItem>(x => x.ExpenseItems).Cascade.AllDeleteOrphan();

The entity can also be directly saved (it is also aggregate root), but during testing this has not be shown to remove the parent association.

There are no references to the parent itself in the child object the association is all in the DB handled by Nhibernate.

There is also no possibility of assigning the same child entity to another parent as expense item (child entity) cannot be added outside of its parent directly. See code below.

 public virtual ExpenseItem AddNewExpenseItem(ExpenseAnalysis analysis,
            string recipientName,
            string purchaseAccountReference,
            string expenseDescription,
            string expenseNotes,
            Money value,
            VATAnalysis vat)
        {
            Validate.IsNotNull<ExpenseAnalysis>(analysis);
            Validate.IsNotNull(expenseDescription);
....


            ExpenseItem newExpenseItem = new ExpenseItem(analysis,
                recipientName,
                purchaseAccountReference,
                expenseDescription,
                expenseNotes,
                value,
                vat,
                expenseItemUniqueReference,
                true,
                Candidate.Assessment);
            _expenseItems.Add(newExpenseItem);
....

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:55:27+00:00Added an answer on June 11, 2026 at 8:55 am

    This problem was caused by a bug in NHibernate. I had set the session to flush never however when you call isdirty on the session the session was being flushed first. The user was deleting the expense item then cancelling the edit but during the isdirty check the deletion was being flushed. Managed to work around this by changing how the session was being managed for this type of dialog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a couple of scripts that I use I have problem that is intermittent.
I have an intermittent problem with some code that writes to a Windows Event
I've inherited a sharepoint workflow, but it seems to have an intermittent problem and
I'm experiencing an intermittent problem with a class that extends javax.swing.text.DefaultStyledDocument . This document
I have an intermittent bug that is confounding me. Any advice on how to
This is a problem I have been trying to track down for a couple
I have this intermittent problem with MySQL 5.1.33 (Community Server) for Windows, where the
I have a production issue that I can't replicate in the development or test
This problem appears to be intermittent, but I am not sure why exactly. When
We have a weird intermittent problem with saving from Word 2007 to our SharePoint

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.