Version increment on joined-subclass uses incorrect column names
Description
Attachments
Activity

Christian Beikov January 21, 2025 at 1:23 PM
Ran the test on ORM 6 and it works just fine.

Dylan Koby August 18, 2022 at 9:07 AM
Hi, proposed a one line patch. Any chance that it will be considered ?
Thank you.

Spencer Van Hoose May 29, 2017 at 7:07 PM
We recently upgraded our application to 5.2.10 and this bug is still present. The fix is still in the same location in AbstractEntityPersister.
Steve Ebersole October 28, 2015 at 3:25 AM
As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.
Steve Ebersole October 27, 2015 at 7:16 PM
This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.
For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/
When forcing a version increment on an entity mapped with joined-subclass, the generated SQL will be incorrect if the subclass has a different ID column than the parent.
Test case:
Result:
java.sql.SQLSyntaxErrorException: ORA-00904: "PHONE_ID": invalid identifier
The full stack trace can be found in the attached file. Basically, hibernate tries to use the ID column for the subclass table when building the update statement (PHONE_ID in this case) but since the update is being performed on the root table, the column does not exist and the update fails.
This bug was previously reported as but was closed for not including a test case. We have been using the patch attached to that bug successfully in our application.