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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:06:08+00:00 2026-05-14T01:06:08+00:00

We are getting this error after upgrading to NHibernate 2.1. [QueryException: Cannot simultaneously fetch

  • 0

We are getting this error after upgrading to NHibernate 2.1.

[QueryException: Cannot simultaneously fetch multiple bags.]
   NHibernate.Loader.BasicLoader.PostInstantiate() +418
   NHibernate.Loader.Entity.EntityLoader..ctor(IOuterJoinLoadable persister, String[] uniqueKey, IType uniqueKeyType, Int32 batchSize, LockMode lockMode, ISessionFactoryImplementor factory, IDictionary`2 enabledFilters) +123
   NHibernate.Loader.Entity.BatchingEntityLoader.CreateBatchingEntityLoader(IOuterJoinLoadable persister, Int32 maxBatchSize, LockMode lockMode, ISessionFactoryImplementor factory, IDictionary`2 enabledFilters) +263
   NHibernate.Persister.Entity.AbstractEntityPersister.CreateEntityLoader(LockMode lockMode, IDictionary`2 enabledFilters) +26
   NHibernate.Persister.Entity.AbstractEntityPersister.CreateLoaders() +57
   NHibernate.Persister.Entity.AbstractEntityPersister.PostInstantiate() +1244
   NHibernate.Persister.Entity.SingleTableEntityPersister.PostInstantiate() +18
   NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) +3261
   NHibernate.Cfg.Configuration.BuildSessionFactory() +87

Without stepping into the NHibernate source, it doesn’t look like I can see which mapping is creating the issue.

It’s a very old application with a load of mappings files, lots of mappings have one-to-many bags in them, all lazy instantiated.

For example:

    <bag name="Ownership" lazy="true" cascade="all" inverse="true" outer-join="auto" where="fkOwnershipStatusID!=6">
        <key column="fkStakeHolderID"/>
        <one-to-many class="StakeholderLib.Ownership,StakeholderLib" />
    </bag>

maps to:

public virtual IList Ownership {
        get {
            if (ownership == null)
                ownership = new ArrayList();
            return ownership;
        }
        set { ownership = value; }
    }    

Has anyone seen this error before when upgrading to NHibernate 2.1?

  • 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-14T01:06:09+00:00Added an answer on May 14, 2026 at 1:06 am

    We found the answer eventually…

    We had an entity that had more than 1 bag with a many to many relationship that had

    outer-join="true"
    

    set.

    This caused the error because when you set outer-join fetching you usually do this to limit the db round-trips, enabling nHibernate to retrieve the whole association in 1 select. In this circumstance this will cause a pre-fetch on each bag immediately causing the error.

    We changed that to outer-join=”auto” (as below) and they stopped being pre-fetched. This stopped nHibernate attempting to fetch multiple bags simultaneously.

    <bag name="Groups" lazy="true" cascade="none" table="dbname..tablename">
        <key column="foreignkeyname" />
            <many-to-many class="classname.typename,assemblyname"
                    column="foreignkeyname" outer-join="auto" />
    </bag>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 491k
  • Answers 491k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your problem is that you need to outsource trust. If… May 16, 2026 at 10:04 am
  • Editorial Team
    Editorial Team added an answer The Win32 API GetFileSize will return the uncompressed file size.… May 16, 2026 at 10:04 am
  • Editorial Team
    Editorial Team added an answer For PowerPoint, see this MS KB article here: http://support.microsoft.com/kb/913045 Screen… May 16, 2026 at 10:04 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

When using ANT to build my Java application I keep getting this error. I
I'm getting a java.awt.FontFormatException: Unrecognised Font Format error, and I believe this has been
Im getting this error when I try and make an object. Here is my
I am getting the following error after deploying my web application to a 2008
This is the error I'm getting when trying to compile some code that uses
I'm getting this error: Only parameterless constructors and initializers are supported in LINQ to
Here's the whole error I keep getting from xerces.... When <simpleContent> is used, the
As part of upgrading JRun, we are moving from a 1.4 JVM to a
I had no problems using NHaml with ASP.NET MVC Beta, but when upgrading to
I will start by saying this is the first time I have done anything

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.