Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix DELETE query in derived delete operations #2128

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

Open
Huiyeongkim wants to merge 1 commit into spring-projects:main
base: main
Choose a base branch
Loading
from Huiyeongkim:issue-2123

Conversation

Copy link

@Huiyeongkim Huiyeongkim commented Aug 29, 2025
edited
Loading

  • Use correct ID column for child entities in JdbcDeleteQueryCreator
  • Remove getIdDefiningParentPath() to reference current entity ID
  • Rename parentIdColumns to idColumns for clarity
  • Add test case for custom ID column name (@column("CHILD_ID"))

Fixes errors when deleting child entities with non-standard ID column names.

Fixes #2123

injae-kim reacted with thumbs up emoji injae-kim reacted with heart emoji injae-kim reacted with rocket emoji
@@ -109,7 +110,7 @@ static class ChildElement {

String name;
Set<GrandChildElement> content = new HashSet<>();
@Id private Long id;
@Id@Column("CHILD_ID") private Long id;
Copy link
Contributor

@chanhyeong chanhyeong Aug 29, 2025

Choose a reason for hiding this comment

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

I don't know how maintainers will think about this, but I was planning to maintain the existing codes, and create new test cases and classes to verify fixed.
The changes of test I made were just for reporting.

injae-kim reacted with eyes emoji
Copy link

@injae-kim injae-kim Aug 29, 2025

Choose a reason for hiding this comment

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

but I was planning to maintain the existing codes

Hi @chanhyeong! I'm helping @Huiyeongkim's first contribution by https://medium.com/opensource-contributors.

Can you explain more details about existing codes that you plan to edit?
We simply want to know how you think to fix this issue 🙇

chanhyeong reacted with thumbs up emoji
Copy link
Contributor

@chanhyeong chanhyeong Aug 30, 2025

Choose a reason for hiding this comment

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

@injae-kim
I planned adding some classes like CustomIdChildElement and test cases for them.
PR author explained 'Add test case for custom ID column name', but there are no added cases.

However, as I commented before, I'm careful because I'm not a maintainer.

injae-kim reacted with thumbs up emoji injae-kim reacted with heart emoji
Copy link
Author

@Huiyeongkim Huiyeongkim Aug 30, 2025
edited
Loading

Choose a reason for hiding this comment

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

@chanhyeong
Thanks for pointing that out. I'll try adding the test and update the PR accordingly

Copy link
Contributor

@chanhyeong chanhyeong Aug 30, 2025

Choose a reason for hiding this comment

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

Sure! I just wrote my opinion.

Copy link
Author

@Huiyeongkim Huiyeongkim Aug 30, 2025

Choose a reason for hiding this comment

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

@chanhyeong
Thank you! I’ve added the test as discussed.

injae-kim and chanhyeong reacted with thumbs up emoji
@Huiyeongkim Huiyeongkim force-pushed the issue-2123 branch 2 times, most recently from f970f7b to 174defd Compare August 30, 2025 09:43
@schauder schauder self-assigned this Sep 1, 2025
Copy link
Contributor

@schauder schauder left a comment

Choose a reason for hiding this comment

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

This PR causes JdbcRepositoryEmbeddedWithCollectionIntegrationTests.deleteBy() to fail.

Please make sure to run all tests, if possible against all supported databases.

You do this by running

./mvnw clean verify
or
./mvnw clean verify -Pall-dbs

The later requires Docker to run on your machine and also the acceptance of some db licenses, which you can accept by running ci/accept-third-party-license.sh. Of course, you should review any license you are accepting.

*/
@IntegrationTest
@EnabledOnDatabase(DatabaseType.HSQL)
class JdbcRepositoryWithCollectionsCustomIdIntegrationTests {
Copy link
Contributor

@schauder schauder Sep 1, 2025

Choose a reason for hiding this comment

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

I'd rather not have another full integration test class, but go with the approach you used in the reproducer of just tweaking the existing JdbcRepositoryWithCollectionsChainHsqlIntegrationTests.java

Copy link
Author

@Huiyeongkim Huiyeongkim Sep 2, 2025

Choose a reason for hiding this comment

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

@schauder
Thanks for pointing that out!
I’ll adjust the test case in JdbcRepositoryWithCollectionsChainHsqlIntegrationTests instead of adding a new class,
and re-run ./mvnw clean verify to make sure everything passes.

Copy link
Author

@Huiyeongkim Huiyeongkim Sep 3, 2025

Choose a reason for hiding this comment

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

@schauder
As suggested, I have updated JdbcRepositoryWithCollectionsChainHsqlIntegrationTests.java.
No new integration test class was added.

@schauder schauder added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 1, 2025
- Support @column annotation on ID fields when deleting collection entities
- Fallback to parent path IDs for embedded collections
- Add test for custom ID column DELETE operations
Fixes DATAJDBC-2123
Signed-off-by: Huiyeongkim <huiyeong9619@naver.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@schauder schauder schauder requested changes

+2 more reviewers

@chanhyeong chanhyeong chanhyeong left review comments

@injae-kim injae-kim injae-kim left review comments

Reviewers whose approvals may not affect merge requirements
Labels
status: waiting-for-feedback We need additional information before we can continue
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Invalid DELETE created in derived query

AltStyle によって変換されたページ (->オリジナル) /