Skip to content

One-to-one mapping behaviour change with Version 5.4.0 #3204

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

You must be logged in to vote

Behavior is changed by implementing proper caching for one-to-one association #2576

In 5.4.1+ restore old behavior by setting optimistic-lock="false" for one-to-one mapping (.Not.OptimisticLock() in Fluent NHibernate):

  public HasOneParentMap()
  {
      this.HasOne(x => x.Child)
          .PropertyRef(x => x.Parent)
          .Not.OptimisticLock() //<-- added code
          .Cascade.All();

From one-to-one xml mapping doc:

optimistic-lock (optional - defaults to true): Specifies that updates to this property do or do not require acquisition of the optimistic lock. In other words, determines if a version increment should occur when this property is dirty.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@fhaemmerli

This comment has been hidden.

@bahusoid

This comment has been hidden.

@fhaemmerli
Comment options

@fredericDelaporte
Comment options

Answer selected by fhaemmerli

This comment has been hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants