|
From: Tomer A. (JIRA) <nh...@gm...> - 2011-02-28 15:43:28
|
[ http://216.121.112.228/browse/NH-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20604#action_20604 ]
Tomer Avissar commented on NH-1001:
-----------------------------------
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.
> Select statement issued for each not-found=ignore
> -------------------------------------------------
>
> Key: NH-1001
> URL: http://216.121.112.228/browse/NH-1001
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.0.GA
> Reporter: Tomer Avissar
> Priority: Minor
> Attachments: HRNHibernateTest.zip
>
>
> 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|