Skip to content
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

Change cascade style for DefaultDirtyCheckEventListener to persist to avoid flushing the session #2752

Merged
merged 4 commits into from
May 15, 2021

Conversation

hazzik
Copy link
Member

@hazzik hazzik commented May 10, 2021

The default cascade for it was SaveUpdate (via base AbstractFlushingEventListener) which triggered
insertion of the entities with post-insert style ID generators (eg. identity). Persist on the other hand will
make sure that insertion of the entity is delayed until flush is called.

Related to #1413

… flush

The default cascade for it was SaveUpdate (via base AbstractFlushingEventListener) which triggered
insertion of the entities with post-insert style ID generators (eg. identity). Persist on the other hand will
make sure that insertion of the entity is delyed until flush is called.

Fixes nhibernate#1413
@hazzik hazzik changed the title Change cascade style for DefaultDirtyCheckEventListener to persist on flush Change cascade style for DefaultDirtyCheckEventListener to persist to avoid flushing the session May 11, 2021
@hazzik
Copy link
Member Author

hazzik commented May 11, 2021

@bahusoid @fredericDelaporte could you please review?

@hazzik hazzik requested a review from bahusoid May 14, 2021 10:38
@hazzik
Copy link
Member Author

hazzik commented May 14, 2021

@fredericDelaporte can I please get some thoughts why this change might be a bad idea? To be honest I wasn't looking for a silent tick ;-)

@bahusoid
Copy link
Member

Well it's not exactly immutable operation (session state is changed) but it's definitely an improvement over old behavior. So why not..

But I still would like to have IsDirty check that doesn't modify session in any way - so maybe let's not close #1413 yet.

why this change might be a bad idea?

Not exactly sure about real use case but something similar to #2632 might come up

@fredericDelaporte
Copy link
Member

fredericDelaporte commented May 14, 2021

I did think a lot about what could possibly go wrong by switching the cascade style for the dirty check from SaveUpdate to Persist, but I could not find anything. So I have approved.

@hazzik hazzik removed the request for review from bahusoid May 15, 2021 01:17
@hazzik
Copy link
Member Author

hazzik commented May 15, 2021

But I still would like to have IsDirty check that doesn't modify session in any way - so maybe let's not close #1413 yet.

Sure.

@Roman-Evseev
Copy link

This change still allows IsDirty to modify the database, causing a NullReferenceException in certain scenarios. Therefore, the commit description does not accurately reflect the intended goals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants