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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:13:41+00:00 2026-05-26T17:13:41+00:00

I am getting a MismatchedTreeNodeException throw with the simple query below using NHibernate 3.2.0.4000.

  • 0

I am getting a MismatchedTreeNodeException throw with the simple query below using NHibernate 3.2.0.4000. I am assuming it is a bug and if so does anyone know of a work around?

var result = session.Query<File>()
    .OrderBy(x => x.Author)
    .GroupBy(file => file.Author)
    .Select(author => new FileAuthor(author.Key, author.Count()))
    .ToList();
  • 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-26T17:13:42+00:00Added an answer on May 26, 2026 at 5:13 pm

    I have played around with your example and query in this form works fine:

    var result = session.Query<File>()
                        .GroupBy(file => file.Author)
                        .Select(author => new
                        {
                           Key = author.Key.AuthorId,
                           Count = author.Count()
                        })
                        .ToList();
    

    Apparently, when you group by entity, it is possible only to project its ID and aggregations. It seems that sorting needs to be done on the client.

    Used mappings:

     <class name="Author" table="authors">
            <id name="AuthorId" column="author_id" />
    
        <property name="AuthorName" column="author_name" />
    
        <bag name="Files">
          <key>
            <column name="author_id" />
          </key>
          <one-to-many class="File"/>
        </bag>
    
      </class>
    
      <class name="File" table="files">
            <id name="FileId" column="file_id" />
    
        <property name="FileName" column="file_name" />
    
        <many-to-one name="Author" class="Author">
          <column name="author_id"  />
        </many-to-one>
    
      </class>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting started with NHibernate How can I generate identity fields in nHibernate using Hilo
Getting very annoyed with this simple query... I need to add an offset to
Getting this message inside gdb. I know its not an error or anything. I
Getting a weird error box when using the 64bit version of adobepdf ifilter for
Getting to grips with ASP.Net Ajax I've got a simple UpdatePanel with an associated
getting a no method error while using clearance for authentication, i was trying to
getting errors when trying to write into a SQL database using the 2 following
Getting an error if using Apache Commons Validator: java.lang.NoClassDefFoundError: org/apache/oro/text/perl/Perl5Util Even if, Apache Commons
Getting thrown into ColdFusion dev at work and just starting out, I wonder if
Getting started with python. I am trying to implement positional index using nested dictionary.

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.