-
Notifications
You must be signed in to change notification settings - Fork 935
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
Conversation
… 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
@bahusoid @fredericDelaporte could you please review? |
@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 ;-) |
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.
Not exactly sure about real use case but something similar to #2632 might come up |
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. |
Sure. |
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. |
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