Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bahusoid
Copy link
Member

@bahusoid bahusoid commented Dec 1, 2021

Original version has some strange logic for handling proxies..

@bahusoid bahusoid changed the title Refactor BetGuessEntityName Refactor BestGuessEntityName Dec 1, 2021
Comment on lines -967 to -973
// 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();
Copy link
Member

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.

Copy link
Member Author

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.

hazzik
hazzik previously approved these changes Dec 14, 2021
@hazzik
Copy link
Member

hazzik commented Dec 14, 2021

@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>
@bahusoid bahusoid changed the title Refactor BestGuessEntityName WIP Refactor BestGuessEntityName Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants