Don't fetch id from proxy target
Description
Environment
None
Activity
Show:
Alex Zaytsev October 21, 2013 at 2:04 AM
Commited to master 183e05f113bbe0f671710e905c48f26b885b692d
Roger May 3, 2012 at 2:12 PM
Pull request here
https://github.com/nhibernate/nhibernate-core/pull/98
Fixed
Details
Details
Assignee
Alex Zaytsev
Alex ZaytsevReporter
Roger
RogerComponents
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created May 3, 2012 at 1:44 PM
Updated September 21, 2014 at 12:42 PM
Resolved October 21, 2013 at 2:04 AM
Who's Looking?
In BasicLazyInitializer, the Identifier is only returned directly from this instance if proxy hasn't been initialized - if not, it's fetched from the target using reflection. In big use cases/algorithms where a lot of id compares are done, it makes a big difference if id is returned by direct call or not.
I cannot really see why this check was in the code in the first place - assuming id value is immutable. After this change, my small test case runs much faster and all other tests are green.
I will link to a pull request shortly.