Deleting all entities of a given type fails when using a composite primary key and order_updates
Description
is fixed by
Activity
Show:

Andrea Boriero July 13, 2023 at 4:43 PM
i created the reproducer for this case and tested with your fix for but it seem not working .
Can you please give a look at ? Thanks

Philip Lowney July 12, 2023 at 11:47 AM
Thank you @Marco Balladelli for checking into this so quickly. I will build locally once HH-26709 is merged and I will confirm that this is resolved.
Marco Belladelli July 12, 2023 at 8:19 AMEdited
Hello , the error you’re encountering looks identical to what the user reported in .
I believe my proposed change will fix your issue too. As soon as that’s merged you can try building locally to verify this, or wait for the next release of Hibernate to try it out.
We are unable to use the Spring Data JPA’s CrudRepository.deleteAll() method for an entity. We are using the following dependencies:
We originally posted this bug to the Spring Data JPA team however after investigating it they suggested it is a Hibernate bug - .
Entity Model
Our Entity Model consists of the following:
Note that
FormVersion
entities have a composite primary key consisting of the Form ID and a version number.Bug
When we create more than one
FormVersion
entity and try to delete them all by using theCrudRepository.deleteAll()
method, we encounter the following error:
Note that when the entity model is modified to remove the
FormInput
entity, the bug does not occur. It may be related in some way to the composite primary key on theFormVersion
entity being used as a foreign key by theFormInput
entity.Possibly Related Bug
We are aware of an existing bug relating to
deleteAll()
: I believe this is likely separate to this issue however because the workaround suggested - add getters and setters to all fields - does not apply here as all fields on entities already have getters and setters.Entity Model
Our entities are as follows:
Test Case
We have created a project on Github reproducing the issue here: