Skip to content

Introduce @InsertOnlyProperty. #1327

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

Closed
wants to merge 4 commits into from
Closed

Conversation

schauder
Copy link
Contributor

For Spring Data JDBC you may now annotate properties of the aggregate root with @InsertOnlyProperty.
Properties annotated in such way will be written to the database only during insert operations, but they will not be updated afterwards.

Closes #637

@schauder schauder requested a review from mp911de September 13, 2022 10:35
@mp911de
Copy link
Member

mp911de commented Sep 13, 2022

Can we have that for R2DBC as well to keep both modules in sync when we build new features?

schauder and others added 3 commits September 20, 2022 13:18
For Spring Data JDBC you may now annotate properties of the aggregate root with `@InsertOnlyProperty`.
Properties annotated in such way will be written to the database only during insert operations, but they will not be updated afterwards.

Closes #637
You may now annotate properties of the aggregate root with `@InsertOnlyProperty`.
Properties annotated in such way will be written to the database only during insert operations, but they will not be updated afterwards.

Closes #637
@schauder schauder force-pushed the issue/637-insert-only-property branch from 3d200b3 to 93d1bc1 Compare September 20, 2022 12:03
@schauder
Copy link
Contributor Author

Added the R2DBC support.
I also rebased onto the current main.

The second commit message is intended to work as the one commit message after squashing.

@schauder schauder force-pushed the issue/637-insert-only-property branch 4 times, most recently from 6432168 to 93808d2 Compare September 20, 2022 13:54
@schauder schauder force-pushed the issue/637-insert-only-property branch from 93808d2 to 3be9494 Compare September 20, 2022 14:42
public Flux<T> all() {
return delegate.all().concatMap(it -> maybeCallAfterConvert(it, tableName));
}
}
Copy link
Member

@mp911de mp911de Oct 5, 2022

Choose a reason for hiding this comment

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

This file got reformatted using spaces. Mind checking your formatter settings and reformat that one to avoid merge conflicts?

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Documented
public @interface InsertOnlyProperty {
Copy link
Member

Choose a reason for hiding this comment

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

Documentation?

Copy link
Member

@mp911de mp911de left a comment

Choose a reason for hiding this comment

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

I left a few comments. Please also squash the actual changes into one commit.

schauder added a commit that referenced this pull request Oct 6, 2022
You may now annotate properties of the aggregate root with `@InsertOnlyProperty`.
Properties annotated in such way will be written to the database only during insert operations, but they will not be updated afterwards.

Closes #637
Original pull request #1327
@schauder
Copy link
Contributor Author

schauder commented Oct 6, 2022

Fixed, squashed and merged.

@schauder schauder closed this Oct 6, 2022
@schauder schauder deleted the issue/637-insert-only-property branch October 6, 2022 10:58
@schauder schauder added this to the 3.0 RC1 (2022.0.0) milestone Oct 10, 2022
@Husan
Copy link

Husan commented Nov 14, 2022

May be its too late write any suggestion. But let me write my idea about it. What if will be added property ChangeConditionProperty which get array of strings such as "INSERT", "UPDATE". And then from this condition attribute may be included or excluded from an update script. Thanks!

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.

Add an "InsertOnly" annotation to support a write-once semantic. [DATAJDBC-416]
3 participants