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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:07:35+00:00 2026-05-26T23:07:35+00:00

I’ve read many posts about this, the last being a statement saying the behaviour

  • 0

I’ve read many posts about this, the last being a statement saying the behaviour i’m experiencing the the expected if not preferred way.

I’ve got a handful of domain models mapped to their database tables.

I’m using a Criteria object to query them.

 var query = session.CreateCriteria(typeof(Posting))
                .CreateAlias("Person", "person", JoinType.InnerJoin).SetFetchMode("Person", FetchMode.Eager)
                .CreateAlias("Location", "location", JoinType.InnerJoin).SetFetchMode("Location", FetchMode.Eager)
                .CreateAlias("Post", "post", JoinType.InnerJoin).SetFetchMode("Post", FetchMode.Eager)
                .CreateAlias("post.Zone", "postzone", JoinType.LeftOuterJoin).SetFetchMode("post.Zone", FetchMode.Select)

It produces the exact statment I’m looking for. I’d expect it to populate the objects eagerly (which it does) and leave nulls for post.Zone where the relationship fails.

In my mapping i’ve had to say not-found=ignore (Notfound.Ignore() FNH) which due to the outer join is causing NH to generate a number of sub-query – all on the Zone table – which doesn’t seem necessary to me, especially as it already had the data it need to populate the Zone object.

Can anyone she any light on any changes I can make to the Mapping or Query/Criteria to keep this load to a single query, or should I expect an extra statement for every record outer joined to?

Thanks,
Sam

  • 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-26T23:07:36+00:00Added an answer on May 26, 2026 at 11:07 pm

    It is unfortunatly a known issue that not-found=ignore causes additional selects. There have been bug reports filed for this in both NHibernate and Hibernate for quite some time (2007) and currently no known work around has been made available other than removing not-found=ignore or changing the data present in the database so it is no longer required.

    A possible work around, although not a nice one, would be to have a stored procedure perform the query you want and then call this from NHibernate. This would remove the redundant queries.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post

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.