This seems to be fixed in Hibernate 6.2.0.CR3. The relevant change is https://hibernate.atlassian.net/browse/HHH-15964.