Skip to content

Conversation

Huiyeongkim
Copy link

@Huiyeongkim Huiyeongkim commented Aug 29, 2025

  • 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

@@ -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

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.

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 🙇

Copy link
Contributor

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.

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
Thanks for pointing that out. I'll try adding the test and update the PR accordingly

Copy link
Contributor

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

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.

@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

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

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

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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback We need additional information before we can continue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid DELETE created in derived query
5 participants