-
Notifications
You must be signed in to change notification settings - Fork 1.5k
JpaRepository#deleteAllByIdInBatch fails when (compound) IdClass keys are used #2414
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
Comments
The code in deleteAllInBatch uses a different approach to do the deletion. It creates an OR query. Could this be used as solution for this method also? As a workaround I use the deleteAllInBatch in combination with getById currently, but I think deleteAllByIdInBatch should handle compound IdClass id's also. |
Possible quick fix in SimpleJpaRepository
|
I created a fork with both test and (quick) fix. But do not know how to create a PR/MR (yet). |
Convert ID's to entities and pass them to deleteAllInBatch. Issue: spring-projects#2414
Convert ID's to entities and pass them to deleteAllInBatch. Issue: spring-projects#2414
Convert ID's to entities and pass them to deleteAllInBatch. Issue: spring-projects#2414
Convert ID's to entities and pass them to deleteAllInBatch. Issue: spring-projects#2414
Convert ID's to entities and pass them to deleteAllInBatch. Closes spring-projects#2414
Convert ID's to entities and pass them to deleteAllInBatch. Closes spring-projects#2414
Convert ID's to entities and pass them to deleteAllInBatch. Closes spring-projects#2414
Convert ID's to entities and pass them to deleteAllInBatch. Fixes spring-projects#2414
I left the original code intact in case of non compound keys, because the generated in query suits the simple case better. |
@schauder , I created a PR. Can I ask you to review it or is there another way to ask for review? Or am I just impatient? |
Thx @schauder |
When using an JpaRepository with an compound IdClass the deleteAllByIdInBatch methods fails with an IllegalArgumentException like:
Below a test I added to org.springframework.data.jpa.repository.RepositoryWithCompositeKeyTests that fails also (on 2.6.x branch).
Could this be fixed and back ported to the 2.5 branch also? Because we are running Spring Boot 2.5.
The text was updated successfully, but these errors were encountered: