As i crawled trough JIRA to find the related bugs, i stumbled upon
this comment

Tomer Avissar commented on NH-1001 (Select statement issued for each
not-found=ignore) saying:
It's been a while since I logged this, but if I recall correctly, the
issue is if you like to view it that way, is that the first level
cache does not work for non existing records. Meaning, when NHibernate
queries an entity (either by ID or through join) and receives no
records, it does not save this information and therefore will query
this entity over and over again, even though in each time it will get
no records.

For example if I have a "Employee" entity with a many-to-one
"Department" entity, if I change the many-to-one fetch mode to join,
Instead of getting only one single joined statement, I will still get
many select statements for each employee that did not exist in the
employee table.

BTW: One more problem that the not-found="ignore" brings, is that if I
had an Employee object with DEPARTMENT_ID=5 that does not exist, It
will result in a NULL value in the Department property. Upon flush, it
will update the DEPARTMENT_ID value to NULL.
I would expect NHibernate to not update this column in this case, but
a guess that's a matter for a new issue.

This is the statement i found the most valuable : 'when NHibernate
queries an entity (either by ID or through join) and receives no
records, it does not save this information and therefore will query
this entity over and over again, even though in each time it will get
no records"

So i suspect there is no solution for this.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to