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

Investigate potential usage of wither-methods for setting bean values [DATACMNS-1239] #1678

Closed
spring-projects-issues opened this issue Jan 4, 2018 · 0 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Jan 4, 2018

Oliver Drotbohm opened DATACMNS-1239 and commented

There are a couple of places in the framework where we need to programmatically tweak the state of an entity for technical reasons. One of them is optimistic locking where we need to initialize the version property.

If an entity class is designed to be immutable, it's unexpected that we tweak the instance given. Assuming the class exposed explicit means to create new instances with a certain property set to a different value (e.g. withVersion(…)) we could rather use that instead of manipulating the field.

There are two main options how to achieve this:

  1. A solution specific to versioning that invokes a wither method for the version property and the optimistic locking code overhauled to use that new API.
  2. A generic mechanism in the property access APIs that prefers withers over setters

Issue Links:

  • DATACMNS-1322 Add support for immutable objects in PersistentPropertyAccessor
    ("duplicates")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants