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 923849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:15:26+00:00 2026-05-15T19:15:26+00:00

When I update (with a flush) one record in a list of records retrieved

  • 0

When I update (with a flush) one record in a list of records retrieved from the database nHibernate is versioning all of the records that were in the original list.

Retrieving a list of records from the database:

using(UnitOfWork.Start())
{
   queuedJobs = aJobServiceManager.GetAllJobs().Where(aJob => aJob.Status == PricingStatus.QUEUED).ToList();
}

/* Do some work on the record*/
using(UnitOfWork.Start())
{
   //aJob is a record from queuedJobs.
   aJobServiceManager.Save(aJob);
   //When Flush is called I'm expecting only aJob to be updated in the database.
   //aJob is correctly updated BUT
   //All the other records in queuedJobs are also updated (their version field is incremented).
   UnitOfWork.Current.Flush();
}

Why is nHibernate updating all the records when they haven’t changed and how do you stop this behavior?

  • 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-05-15T19:15:27+00:00Added an answer on May 15, 2026 at 7:15 pm

    This is most likely the problem you’re running into: http://nhibernate.info/blog/2008/10/20/how-test-your-mappings-the-ghostbuster.html

    It would help to see your mapping file for job. If you’re doing something like

    <property name="Status" type="int" /> 
    

    Where Status is actually StatusEnum you’ll end up with ghosting.

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

Sidebar

Related Questions

During usage of NHibernate ... One strange problem that I have bumped into was
I have a list of 10 data objects that I want to insert/update to
One of the things that get me thoroughly confused is the use of session.Flush
[2015 update: I think it's safe to say that Flash is rapidly dying. Don't
Update: I reported this as a bug to Apple and they fixed it! All
Update : This is no longer an issue from C# 6, which has introduced
I have a method that virtually deletes ALL messages of a current_user and by
I have entity User with one-to-many relationship to UserToUserCategories. When I load user from
i have a TLF in a form in one of my sites. from a
I try to create a partial with an update form for one of my

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.