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

Version not updated on collection change if entity has changes on property with optimistic-lock="false" #3631

Open
csharper2010 opened this issue Dec 10, 2024 · 0 comments

Comments

@csharper2010
Copy link
Contributor

I have an entity with ordinary properties, a property with optimistic-lock="false" and a set (implicitly with optimistic-lock="true" as it's the default value).

If I just add a child entity to the collection, the version is incremented correctly but if I change a property without optimistic lock at the same time, the version is not incremented.

The version must be incremented if at least one property (including collections) with optimistic-lock="true" is changed.

The reason is that FlushEntityEvent.HasDirtyCollections is not filled in case there dirty properties but this doesn't take into consideration whether the dirty properties lead to a version increment. Calling DefaultFlushEntityEventListener.HasDirtyCollections is necessary because of the side effect it has on the Event.

wvopt pushed a commit to csharper2010/nhibernate-core that referenced this issue Dec 10, 2024
Incrementing Version on parent entity for a collection change works correctly
even with optimistic-lock="false" on another property of the same entity.
Call to HasDirtyCollections has a side effect thus must be called independently
from the existence of other dirty properties.
wvopt pushed a commit to csharper2010/nhibernate-core that referenced this issue Dec 10, 2024
Incrementing Version on parent entity for a collection change works correctly
even with optimistic-lock="false" on another property of the same entity.
Call to HasDirtyCollections has a side effect thus must be called independently
from the existence of other dirty properties.
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

No branches or pull requests

1 participant