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

Lazy property with nosetter accessor remains uninitialized #3333

Closed
sashakboo opened this issue Jun 21, 2023 · 3 comments
Closed

Lazy property with nosetter accessor remains uninitialized #3333

sashakboo opened this issue Jun 21, 2023 · 3 comments

Comments

@sashakboo
Copy link
Contributor

sashakboo commented Jun 21, 2023

In my project after upgrading from version 5.2 to 5.3 there is a problem with lazy properties that have nosetter.pascal-underscore accessor in their mapping.

  • After accessing the property it remains uninitialized
  • Each call to a property getter returns a new object

I have added tests which demonstrate the problem #3331

There is no such problem in version 5.2 #3332

@sashakboo sashakboo changed the title Lazy property with nosetter.pascalcase-underscore accessor still uninitialized Lazy property with nosetter.pascalcase-underscore accessor remains uninitialized Jun 21, 2023
@bahusoid bahusoid added this to the 5.3.18 milestone Jun 21, 2023
@bahusoid
Copy link
Member

Most likely caused by #1943

@bahusoid
Copy link
Member

bahusoid commented Jun 29, 2023

The 5.3.x+ lazy property implementation (#1943 and #1947) expects that both the getter and setter go through interception. And the following method must be called:

public object Intercept(object target, string fieldName, object value, bool setter)
.

However, with field accessor, no interception occurs. This means that lazy property handling is broken in multiple places for nosetter/field lazy property accessors. In addition to the added test, the existing CanMergeTransientWithLazyProperty is also broken. I suspect that fetching such properties in a query would not work either.

I took a quick look at how it is handled in Hibernate and it looks like they do not depend on interception in setter (at least for property initialization I see multiple attributeInitialized calls).

See no easy fix for it.

bahusoid added a commit that referenced this issue Jul 1, 2023
Fixes #3333

Co-authored-by: sashakboo <31510839+sashakboo@users.noreply.github.com>
@bahusoid
Copy link
Member

bahusoid commented Jul 1, 2023

Fixed by #3345

@bahusoid bahusoid closed this as completed Jul 1, 2023
@fredericDelaporte fredericDelaporte changed the title Lazy property with nosetter.pascalcase-underscore accessor remains uninitialized Lazy property with nosetter accessor remains uninitialized Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants