-
Notifications
You must be signed in to change notification settings - Fork 933
WIP Refactor BestGuessEntityName #2953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
14fe2d3
to
445f991
Compare
// it is possible for this method to be called during flush processing, | ||
// so make certain that we do not accidentally initialize an uninitialized proxy | ||
if (initializer.IsUninitialized) | ||
{ | ||
return initializer.PersistentClass.FullName; | ||
} | ||
entity = initializer.GetImplementation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entity name may be different from the proxy entity name. Getting the entity name can be more precise than getting the entity name known by the proxy.
This happens in case of mapped inheritance, when we have a proxy of the base class. When the proxy is initialized, the entity name will be the actual concrete implementation entity name, while the entity name known by the proxy will only be the one of the base class.
So the change here is a possible breaking change: with the change, entity-name guessed from proxies on base classes will always be the base class entity name. With current code it would be the concrete class entity name for initialized proxies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And now old code makes sense :) Fixed and commented.
@bahusoid can you update PR title and description to reflect what changes have been done? "Refactor" is just too ambiguous. And strictly speaking this is not a "refactoring", because behaviour of StatelessSession may have changed. Also, can we have tests for this new behavior of StatelessSession? |
Co-authored-by: Frédéric Delaporte <12201973+fredericDelaporte@users.noreply.github.com>
Original version has some strange logic for handling proxies..