Uploaded image for project: 'NHibernate'
  1. NHibernate
  2. NH-3317

Deep load of root entity with <bag> of details entities that contains collection of deeper entities returns wrong number of detail's entities

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.1.GA
    • Fix Version/s: None
    • Component/s: Core

      Description

      Deep load of entity with two levels of nested collections brings wrong result when first collection mapped as bag.
      In provided example I try to fetch specified blog with it's posts and with it's posts' comments (Blog->Posts->Comments). It works correctly when Blog->Posts mapped as set, but fails when Blog->Posts mapped as bag. I have provided tests for different combinations of bag-set mappings. Also tested different query methods: linq, query over and criteria api.
      In my real model I need it mapped as bag, so mapping as a set is not a workarround for me.

      Tested with
      NH 3.3.1.4000
      .NET 4.5
      SqlServer 2008 Express

      Full test code: https://github.com/stanb/NHExperiments/tree/master/NHBugs

        Attachments

        1. BagDeepQueryTest.cs
          7 kB
        2. MapBagOfBags.hbm.xml
          1 kB
        3. MapBagOfSets.hbm.xml
          1 kB
        4. MapSetOfBags.hbm.xml
          1 kB
        5. MapSetOfSets.hbm.xml
          1 kB
        6. Model.cs
          1 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              stanb Stan Belkin
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Who's Looking?