Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects versions: 3.2.0.GA
    • Fix versions: 3.3.0.CR1
    • Components: Linq Provider
    • Labels:
      None
    • Sprint:

      Description

      Say i have the following code:

      var query = session.Query<Event>().Fetch(e => e.Group).Count();

      This throws the error:

      Query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=0,role=,tableName=dbo.Groups,tableAlias=group1,origin=dbo.Events event0_,colums={event0_.GroupID ,className=Models.Entities.Group}}] [.CountModels.Entities.Event(.FetchModels.Entities.Event,Models.Entities.Group(.CacheableModels.Entities.Event(NHibernate.Linq.NhQueryable`1Models.Entities.Event, ), Quote((e, ) => (e.Group)), ), )]

      This is because Fetch cannot be used on a Count query. See the following for someone who is having a similar problem:

      http://stackoverflow.com/questions/5251306/how-do-you-deal-with-linq-to-nhibernates-fetch-exception-when-selecting-aggregat

      Unfortunately the suggested answer is not ideal.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nfplee Lee Timmins
            • Votes:
              6 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Who's Looking?