Skip to content

Version of unchanged entity is updated only because collection is dirty #3402

Answered by bahusoid
perahoky asked this question in Q&A
Discussion options

You must be logged in to vote

From docs :

You may disable NHibernate's automatic version increment for particular properties and collections by setting the optimistic-lock mapping attribute to false. NHibernate will then no longer increment versions if the property is dirty.

In Fluent NHibernate you need to add .Not.OptimisticLock() to collection mappings:

this.HasMany(x => x.Children).Inverse().Not.OptimisticLock();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@perahoky
Comment options

Answer selected by perahoky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3401 on August 08, 2023 13:48.