|
So, here's the issue:
HHH-1917
's fix is within TableBasedDeleteHandlerImpl. That is used solely by QueryTranslatorImpl#buildAppropriateStatementExecutor when the entity persister "isMultiTable" and therefore uses MultiTableDeleteExecutor. That would explain why adding the joined-subclass in your mappings works. If the entity does not have a joined hierarchy, "isMultiTable" is false and the BasicExecutor is used for the query (skipping the fix).
Steve Ebersole, thoughts on the best route? Technically, we could have buildAppropriateStatementExecutor always return MultiTableDeleteExecutor for DELETE. But obviously that's a performance hit when the entity is truly single table.
Alternatively, we could create a new DeleteExecutor, extended by MultiTableDeleteExecutor, and add the join table orphan handling there. DeleteExecutor would be used instead of BasicExecutor when there's no entity hierarchy/multi table.
|