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

#215 - Add support for EntityCallbacks #397

Closed
wants to merge 4 commits into from
Closed

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Jul 14, 2020

We now support entity callbacks for:

  • AfterConvertCallback
  • BeforeConvertCallback
  • BeforeSaveCallback
  • AfterSaveCallback

through R2dbcEntityTemplate.


Related ticket: #215.

We now support entity callbacks for:

* AfterConvertCallback
* BeforeConvertCallback
* BeforeSaveCallback
* AfterSaveCallback

through R2dbcEntityTemplate.
Simplify what's new section.
| Invoked before a domain object is converted to `OutboundRow`.
| `Ordered.LOWEST_PRECEDENCE`

| AfterConvertCallback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the naming of BeforeConvertCallback and AfterConvertCallback highly confusing.

The names suggests that they happen relative to the same process, one before and one after, while in fact they are completely unrelated.

I think AfterLoadCallback would be a much better name for the AfterConvertCallback.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AfterLoad is typically used before converting objects into an entity. We should rather stick to this convention for consistency across our modules.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I don't think we are doing it this way in Spring Data JDBC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we should align JDBC to the other stores so we can later on introduce a AfterLoad event/callback that gives users a chance to react to values before materializing an object.

@schauder schauder assigned mp911de and unassigned schauder Jul 16, 2020
Reintroduce deprecated setBeanFactory(…) method. Extract code into methods. Ensure that versioned entities are eagerly initialized to allow retries.
@mp911de mp911de requested a review from schauder July 17, 2020 13:11
@mp911de mp911de assigned schauder and unassigned mp911de Jul 17, 2020
@schauder
Copy link
Contributor

That's polished, merged and backported.

@schauder schauder closed this Jul 22, 2020
@schauder schauder reopened this Jul 22, 2020
@schauder
Copy link
Contributor

aarg, wrong PR.

schauder pushed a commit that referenced this pull request Jul 22, 2020
We now support entity callbacks for:

* AfterConvertCallback
* BeforeConvertCallback
* BeforeSaveCallback
* AfterSaveCallback

through R2dbcEntityTemplate.

Original pull request: #397.
schauder pushed a commit that referenced this pull request Jul 22, 2020
Simplify what's new section.

Original pull request: #397.
schauder pushed a commit that referenced this pull request Jul 22, 2020
Reintroduce deprecated setBeanFactory(…) method.
Extract code into methods.
Ensure that versioned entities are eagerly initialized to allow retries.

Original pull request: #397.
schauder added a commit that referenced this pull request Jul 22, 2020
Formatting.

Original pull request: #397.
@schauder
Copy link
Contributor

Now, it's merged and polished.

@schauder schauder closed this Jul 22, 2020
@mp911de mp911de deleted the issue/gh-215 branch July 22, 2020 14:00
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

Successfully merging this pull request may close these issues.

2 participants