Deletion of Parent of @ElementCollection causes a Referential Integrity Constraint Violation

Description

Deleting an entity that contains a `@ElementCollection` with a JPQL query causes a Referential integrity constraint violation.
See reproducer: https://github.com/renegrob/hibernate-test-case-templates/blob/elementcollection-delete-reproducer/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/ElementCollectionDeletionJPAUnitTestCase.java

Environment

None

Assignee

Unassigned

Reporter

René Grob