Skip to content

Values for @Sequence-annotated property generated on update #2003

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
lbueker opened this issue Feb 26, 2025 · 2 comments
Closed

Values for @Sequence-annotated property generated on update #2003

lbueker opened this issue Feb 26, 2025 · 2 comments
Assignees
Labels
type: bug A general bug

Comments

@lbueker
Copy link

lbueker commented Feb 26, 2025

Version: spring-data-jdbc:3.5.0-M1
Currently when using the @Sequence annotation in an entity, it seems to generate a new value on each save.

This results in an error, when trying to update an entity complaining that the newly generated id is not available in the database.

I think there should be a check, so it only generates a new value, when there is none set.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 26, 2025
@mipo256
Copy link
Contributor

mipo256 commented Mar 2, 2025

Hey @schauder @mp911de. This problem is related to the following change: #1955
Please, assign this issue to me, I'll take a look what went wrong

@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 3, 2025
@mp911de
Copy link
Member

mp911de commented Mar 3, 2025

Thanks @lbueker for trying out milestones. @mipo256 assigned to you.

mipo256 added a commit to mipo256/spring-data-relational that referenced this issue Mar 4, 2025
mipo256 added a commit to mipo256/spring-data-relational that referenced this issue Mar 4, 2025
mipo256 added a commit to mipo256/spring-data-relational that referenced this issue Mar 7, 2025
@mp911de mp911de added this to the 3.5 RC1 (2025.0.0) milestone Mar 19, 2025
mipo256 added a commit to mipo256/spring-data-relational that referenced this issue Mar 19, 2025
@mp911de mp911de changed the title @Sequence Annotation generates a new Id on update Values for @Sequence-annotated property generated on update Apr 9, 2025
@mp911de mp911de closed this as completed in 0fc3187 Apr 9, 2025
mp911de added a commit that referenced this issue Apr 9, 2025
Refine assignment flow and use early returns where possible. Cache empty MapSqlParameterSource. Reduce dependency on RelationalMappingContext using a lower-level abstraction signature. Simplify names. Use default value check from Commons. Fix log warning message. Add missing since tags.

Remove superfluous annotations and redundant code. Tweak documentation wording.

Closes #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
Sequence details are now maintained on the property level instead of using the entity level. This is a more accurate representation of the underlying model and that properties are annotated and not entities. It also allows future extension of expanding sequence support to general properties.

Extract abstract support class for sequence generation. Move types to org.springframework.data.jdbc.core.convert to resolve package cycles.

See #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
Sequence details are now maintained on the property level instead of using the entity level. This is a more accurate representation of the underlying model and that properties are annotated and not entities. It also allows future extension of expanding sequence support to general properties.

Extract delegate for sequence generation. Move types to org.springframework.data.jdbc.core.convert to resolve package cycles.

See #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
See #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
See #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
See #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
See #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
See #2003
Original pull request: #2005
mp911de added a commit that referenced this issue Apr 9, 2025
See #2003
Original pull request: #2005
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
4 participants