Here are two patches that I am (successfully) using for testing. Unfortunately, I do not have enough time to analyze if this is correct patch.
Hibernate 6.1
test-patch-v6.1.diff
Hibernate 6.2
test-patch-v6.2.diff