I had to work around that in some tests for https://hibernate.atlassian.net/browse/HSEARCH-4708. Look for the key of this ticket (4718) in the source code to find reproducers.