Select statement issued for each not-found=ignore

Description

When using the not-found=ignore attribute in a one-to-many/many-to-many, NHibernate is issuing a query for every element not found in the collection, even when using an outer join.

In some cases this causes a significant performance overhead.

Environment

None

Attachments

1

Activity

Show:

Alex Zaytsev 
March 11, 2019 at 8:31 AM

Moved here.

Mark Seefeldt 
March 22, 2013 at 5:04 PM

Posted a one-to-one scenario on SO. Hoping someone who knows a workaround has some ideas. http://stackoverflow.com/questions/15575378/mapping-an-extension-table-that-might-not-have-a-row

Johan Haest 
February 14, 2013 at 11:41 AM

Taavi, this is true when you are lazy loading, but what if you are eagerly fetching the row? I can't get any work around for this. This is creating so many queries.

Taavi Kõosaar 
May 4, 2012 at 4:16 PM

A temporary workaround for guys with legacy database issues and cant fix the schema always (im in the same pain).
The Nullable Tuplizer approach works nicely, but needs some maintenance.

http://nhforge.org/blogs/nhibernate/archive/2011/01/28/how-to-use-0-instead-of-null-for-foreign-keys.aspx

Use that approach instead of not-found="ignore". In my case i maintain a list of bad reference cases such as where in database row value can be 0 or-1 to indicate that there is no reference (i.e. supposed to be NULL value in row).

Sÿl 
March 29, 2012 at 1:55 PM

Same here, just signed it to vote for this, issue. I'm using nhibernate 3.2 I'm mapping an odd db in which database is inconsistent.
Would be great if it could fixed soon

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created May 7, 2007 at 7:22 AM
Updated March 11, 2019 at 8:31 AM
Resolved March 11, 2019 at 8:31 AM
Who's Looking?